katzer / cordova-plugin-background-mode

Keep app running in background
Apache License 2.0
1.38k stars 1.03k forks source link

App crashes on Android 8.0 #412

Open Malrok opened 6 years ago

Malrok commented 6 years ago

We are receiving an error on production related to this plugin.

The error is the following:

de.appplant.cordova.plugin.background.BackgroundMode.stopService
BackgroundMode.java - line 259
java.lang.IllegalArgumentException: Service not registered: de.appplant.cordova.plugin.background.BackgroundMode$1@a3be715

And here is the stacktrace:

    android.app.LoadedApk.forgetServiceDispatcher LoadedApk.java:1642
    android.app.ContextImpl.unbindService ContextImpl.java:1818
    android.content.ContextWrapper.unbindService ContextWrapper.java:697
    de.appplant.cordova.plugin.background.BackgroundMode.stopService BackgroundMode.java:259
    de.appplant.cordova.plugin.background.BackgroundMode.onResume BackgroundMode.java:148
    org.apache.cordova.PluginManager.onResume PluginManager.java:264
    org.apache.cordova.CordovaWebViewImpl.handleResume CordovaWebViewImpl.java:448
    org.apache.cordova.CordovaActivity.onResume CordovaActivity.java:275
    android.app.Instrumentation.callActivityOnResume Instrumentation.java:1364
    android.app.Activity.performResume Activity.java:7479
    android.app.ActivityThread.performResumeActivity ActivityThread.java:4147
    android.app.ActivityThread.handleResumeActivity ActivityThread.java:4219
    android.app.ActivityThread$H.handleMessage ActivityThread.java:1944
    android.os.Handler.dispatchMessage Handler.java:108
    android.os.Looper.loop Looper.java:166
    android.app.ActivityThread.main ActivityThread.java:7425
    java.lang.reflect.Method.invoke Method.java
    com.android.internal.os.Zygote$MethodAndArgsCaller.run Zygote.java:245
    com.android.internal.os.ZygoteInit.main ZygoteInit.java:921
gondp commented 5 years ago

Is there any solution for this? For what functions on Android 8+

tajindersinghnamdhari commented 5 years ago

Below solves the issue for Android 8+ https://github.com/katzer/cordova-plugin-background-mode/issues/393#issuecomment-449635095

Tested working on 8.0 on device, while 8.1 & 9.0 on emulator.

mirko77 commented 5 years ago

Same problem on Android 9, LINEAGE OS

mirko77 commented 5 years ago

I have the problem on two Android 9 devices, but it does not happen always, it is random

bhakarajay commented 1 year ago

Same problem on multiple devices

And here is the stack trace:

image (1)