Red-Folder / bgs-core

Core code for the Cordova Background Service
Other
236 stars 104 forks source link

Error on Boot #109

Open kkrukMDC opened 4 years ago

kkrukMDC commented 4 years ago

Hello. Thank you for the awesome plugin. I have been able to get my service to work when I start my application. However, when I boot up I get the following error. Any help would be greatly appriecated.

2020-04-13 20:37:53.454 13716-13716/com.lifechallenge.app D/ReflectionHelper: Attempting to load call: com.notifications.lifechallenge.MyService 2020-04-13 20:37:53.461 3629-11538/? W/ActivityManager: Background start not allowed: service Intent { cmp=com.lifechallenge.app/com.notifications.lifechallenge.MyService } to com.lifechallenge.app/com.notifications.lifechallenge.MyService from pid=13716 uid=10246 pkg=com.lifechallenge.app 2020-04-13 20:37:53.471 13716-13716/com.lifechallenge.app E/AndroidRuntime: FATAL EXCEPTION: main Process: com.lifechallenge.app, PID: 13716 java.lang.RuntimeException: Unable to start receiver com.red_folder.phonegap.plugin.backgroundservice.BootReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.lifechallenge.app/com.notifications.lifechallenge.MyService }: app is in background uid UidRecord{9dfd3d u0a246 RCVR idle procs:1 seq(0,0,0)} at android.app.ActivityThread.handleReceiver(ActivityThread.java:3399) at android.app.ActivityThread.-wrap18(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1780) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6944) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.lifechallenge.app/com.notifications.lifechallenge.MyService }: app is in background uid UidRecord{9dfd3d u0a246 RCVR idle procs:1 seq(0,0,0)} at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1538) at android.app.ContextImpl.startService(ContextImpl.java:1484) at android.content.ContextWrapper.startService(ContextWrapper.java:663) at android.content.ContextWrapper.startService(ContextWrapper.java:663) at com.red_folder.phonegap.plugin.backgroundservice.BootReceiver.onReceive(BootReceiver.java:33) at android.app.ActivityThread.handleReceiver(ActivityThread.java:3392) at android.app.ActivityThread.-wrap18(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1780)  at android.os.Handler.dispatchMessage(Handler.java:105)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6944)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)