DavidBriglio / cordova-plugin-foreground-service

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

Android 8.1 crash #9

Closed rongchaua closed 4 years ago

rongchaua commented 5 years ago

When using in Android 8.1 sometimes (not always) the app has crashed with following errors.

08-16 21:15:47.541 2107 2108 E ANDR-PERF-RESOURCEQS: Failed to apply optimization [2, 0] 08-16 21:15:47.641 1115 1281 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.google.android.apps.nexuslauncher/.NexusLauncherActivity (has extras)} from uid 1000 08-16 21:15:47.641 756 756 D QCOM PowerHAL: LAUNCH HINT: ON 08-16 21:15:47.643 756 756 D QCOM PowerHAL: Activity launch hint handled 08-16 21:15:47.672 1115 1649 W ActivityManager: Bringing down service while still waiting for start foreground: ServiceRecord{3947e4b u0 com.+++.+++/com.davidbriglio.foreground.ForegroundService} 08-16 21:15:47.676 11001 11001 E AndroidRuntime: FATAL EXCEPTION: main 08-16 21:15:47.676 11001 11001 E AndroidRuntime: Process: com.+++.+++, PID: 11001 08-16 21:15:47.676 11001 11001 E AndroidRuntime: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground() 08-16 21:15:47.676 11001 11001 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1768) 08-16 21:15:47.676 11001 11001 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) 08-16 21:15:47.676 11001 11001 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164) 08-16 21:15:47.676 11001 11001 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6494) 08-16 21:15:47.676 11001 11001 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 08-16 21:15:47.676 11001 11001 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 08-16 21:15:47.676 11001 11001 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

The foreground service has been started when app is sent to background.

this.platform.pause.subscribe(() => { if (this.isPlaying) { this.foregroundService.start("title","description","ic_small_icon"); } else { this.foregroundService.stop(); } });

DavidBriglio commented 4 years ago

Are you still experiencing this issue with the new 1.1.3 version?

DavidBriglio commented 4 years ago

Please re-open if you are still having issues.