Android App重新启动时崩溃-不允许启动服务意图

时间:2019-03-07 23:14:38

标签: android typescript ionic-framework ionic3 ionic-native

我为Android实现了一个离子应用程序,具有计算步数的功能。为此,我使用了Cordova的本地api:cordova-plugin-stepcounter。

当我在Samsung S9,Samsung S7,Samsung Note或其他智能手机上安装该应用程序时,将在该应用程序首次启动后计算步骤。我可以关闭该应用程序,并且仍然会计算步骤。一切运行平稳,直到重新启动使应用程序崩溃为止。重新启动手机后,应用程序崩溃且不再计算任何步骤。步骤的值与电话重启之前的值相同。重新启动后,将不再计算步骤。

不幸的是,运行方法“ start(startingOffset)”以使步数计数器再次运行是不够的。为了使Stepcounter再次运行,您必须卸载并重新安装该应用程序。

在下面,您可以找到我的三星手机错误报告的相关部分。

谢谢您的任何建议!! :) 加布里埃尔

------ SYSTEM LOG (logcat -v threadtime -v printable -v uid -d *:v) ------
--------- beginning of crash

    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: FATAL EXCEPTION: main
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: Process: io.ionic.healthyapp, PID: 12405
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver net.texh.cordovapluginstepcounter.StepCounterBootReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=io.ionic.healthyapp/net.texh.cordovapluginstepcounter.StepCounterService }: app is in background uid UidRecord{8ed6a8c u0a243 RCVR idle procs:1 seq(0,0,0)}
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3397)
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at android.app.ActivityThread.-wrap18(Unknown Source:0)
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1780)
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:105)
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164)
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6938)
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=io.ionic.healthyapp/net.texh.cordovapluginstepcounter.StepCounterService }: app is in background uid UidRecord{8ed6a8c u0a243 RCVR idle procs:1 seq(0,0,0)}
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1538)
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at android.app.ContextImpl.startService(ContextImpl.java:1484)
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at android.content.ContextWrapper.startService(ContextWrapper.java:663)
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at android.content.ContextWrapper.startService(ContextWrapper.java:663)
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at net.texh.cordovapluginstepcounter.StepCounterBootReceiver.onReceive(StepCounterBootReceiver.java:17)
    12-30 04:12:35.680 10243 12405 12405 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3390)

0 个答案:

没有答案