DavidBriglio / cordova-plugin-foreground-service

Foreground service with ongoing notification for Android.
MIT License
39 stars 40 forks source link

Appication crashes on launch and giving foreground services error #18

Open bilalswiftsolutions opened 3 years ago

bilalswiftsolutions commented 3 years ago

NOTE: Please make sure you read the readme and fully understand the use of this plugin and its requirements before opening an issue.

Describe the bug I was using foreground services for GPS tracking and it was working fine. But now i added camera plugin after on every app launch I am receiving this error I dont know what does it means

2021-07-05 06:52:56.407 4612-4612/com.siloc.users E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.siloc.users, PID: 4612
    java.lang.RuntimeException: Unable to start service com.davidbriglio.foreground.ForegroundService@7e19bfc with Intent { act=start cmp=com.siloc.users/com.davidbriglio.foreground.ForegroundService (has extras) }: java.lang.SecurityException: Not allowed to delete channel foreground.service.channel with a foreground service
        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.SecurityException: Not allowed to delete channel foreground.service.channel with a foreground service
        at android.os.Parcel.createException(Parcel.java:2085)
        at android.os.Parcel.readException(Parcel.java:2053)
        at android.os.Parcel.readException(Parcel.java:2001)
        at android.app.INotificationManager$Stub$Proxy.deleteNotificationChannel(INotificationManager.java:3589)
        at android.app.NotificationManager.deleteNotificationChannel(NotificationManager.java:788)
        at com.davidbriglio.foreground.ForegroundService.startPluginForegroundService(ForegroundService.java:34)
        at com.davidbriglio.foreground.ForegroundService.onStartCommand(ForegroundService.java:18)
        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) 
     Caused by: android.os.RemoteException: Remote stack trace:
        at com.android.server.notification.NotificationManagerService$10.enforceDeletingChannelHasNoFgService(NotificationManagerService.java:2938)
        at com.android.server.notification.NotificationManagerService$10.deleteNotificationChannel(NotificationManagerService.java:2953)
        at android.app.INotificationManager$Stub.onTransact(INotificationManager.java:1525)
        at android.os.Binder.execTransactInternal(Binder.java:1021)
        at android.os.Binder.execTransact(Binder.java:994)

To Reproduce Steps to reproduce the behavior:

  1. use background location tracking and camera at the same time
  2. Ctry to launch the app

Expected behavior It should crash the application .Application itself is working fine

Smartphone (please complete the following information):

cesarak commented 3 years ago

Same issue here... did you resove?

gnsakash commented 1 year ago

+1

Creiger commented 1 year ago

I have the same problem only when i reload webview and foreground service is started again. Looks like it tries to delete prev instance and create new. Making stop() in app.component onDestroy does not work. =(

rahulwaghule commented 1 month ago

+1