cordova-plugin-foreground-service
cordova-plugin-foreground-service copied to clipboard
Android 8x crash

Plugin crash on android 8x. Any idea about?
Thanks!
same error, but not in all android 8. just under of 10% of all android 8 installs.
any news? the error message is not descriptive
track 1
java.lang.RuntimeException: at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:3821) at android.app.ActivityThread.access$1800 (ActivityThread.java:207) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1779) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loop (Looper.java:193) at android.app.ActivityThread.main (ActivityThread.java:6863) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:537) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858) Caused by: java.lang.NullPointerException: at com.davidbriglio.foreground.ForegroundService.onStartCommand (ForegroundService.java:16) at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:3802)
track2
java.lang.RuntimeException: at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:3744) at android.app.ActivityThread.-wrap20 (Unknown Source) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1880) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loop (Looper.java:166) at android.app.ActivityThread.main (ActivityThread.java:6861) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:450) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:936) Caused by: java.lang.NullPointerException: at com.davidbriglio.foreground.ForegroundService.onStartCommand (ForegroundService.java:16) at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:3718)
I have removed this plugin from my app. It works normally now without crashes. Currently I have problems with some Huawei and Xiaomi devices. I'm using only the background plugin.
Please try using version 1.1.3 and see if this fixes the issue.
Please re-open if you are still having issues.
I use 1.1.3 and still have the issue..
cordova-android 8.1.0
android.app.RemoteServiceException: Bad notification fo startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=0 contentView=null vibrate=null sound=null defailts=0x0 flags=0x62 color=0x0000000 vis=PRIVATE= at android.app.ActivityThread$H.handleMessage ...
Please paste in here the exact method call you are using in your app. I'm not sure why the notification channel would be null since it would be defaulted if one is not provided.
I also have the same issue here with the newest version.
Call to foregroundService:
cordova.plugins.foregroundService.start('Radio', 'Livestream', 'icon', 3, 10);
Error:
java.lang.RuntimeException: at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:4305) at android.app.ActivityThread.access$1900 (ActivityThread.java:267) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2013) at android.os.Handler.dispatchMessage (Handler.java:107) at android.os.Looper.loop (Looper.java:237) at android.app.ActivityThread.main (ActivityThread.java:7770) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1047)
Caused by: java.lang.NullPointerException: at com.davidbriglio.foreground.ForegroundService.onStartCommand (ForegroundService.java:16) at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:4287)
I fix it by using "cordova-plugin-background-mode": "git+https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background.git#1dab2de6ec16e9e6db8c350ee3d1cc9d4bced73a",
that works for me.
facing same issue
2021-07-04 17:32:25.306 24974-24974/com.siloc.users E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.siloc.users, PID: 24974
java.lang.RuntimeException: Unable to start service com.davidbriglio.foreground.ForegroundService@1d25633 with null: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4432)
at android.app.ActivityThread.access$2100(ActivityThread.java:259)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2142)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:230)
at android.app.ActivityThread.main(ActivityThread.java:7880)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:526)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference
at com.davidbriglio.foreground.ForegroundService.onStartCommand(ForegroundService.java:16)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4414)
at android.app.ActivityThread.access$2100(ActivityThread.java:259)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2142)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:230)
at android.app.ActivityThread.main(ActivityThread.java:7880)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:526)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)