tanguyantoine / react-native-music-control

Display and manage media controls on lock screen and notification center for iOS and Android.
https://www.npmjs.com/package/react-native-music-control
MIT License
697 stars 264 forks source link

Context.startForegroundService() did not then call Service.startForeground() #393

Open nahuelb opened 3 years ago

nahuelb commented 3 years ago

Related #266 Version v1.4.0 (latest)

Description

I am experiencing this error on production, but it seems that it only happens to Samsung devices according to BugSnag and when they close the app.

android.app.RemoteServiceExceptionMainActivity
Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{df48845 u0 app.puramente.app/com.tanguyantoine.react.MusicControlNotification$NotificationService}
  1. Sample code (provide repo url or sample code)

  2. Platform ?

    • [ ] iOS
    • [x] Android
  3. Device

    • [ ] Simulator
    • [x] Real device
AugustoAleGon commented 3 years ago

+1

sturmenta commented 3 years ago

+1

josh-deprogram commented 3 years ago

+1

bradfloodx commented 3 years ago

Anyone able to investigate and provide some more insight or bug fixes/PRs?

@AugustoAleGon @sturmenta @josh-deprogram

fandypeng commented 2 years ago

my code worked fine on android 8.1.0, but got the same issue on android 9/10 devices. any update ?

Nyrox commented 2 years ago

Happening on OnePlus 8T with Android 12.

fandypeng commented 2 years ago

my code worked fine on android 8.1.0, but got the same issue on android 9/10 devices. any update ?

Fixed by adding notification permissions, it's my fatal...

rafaelmaeuer commented 2 years ago

@fandypeng could you share your solution?

PaulCombal commented 2 years ago

Still the same issue on an Expo client. Crashes 5 seconds after opening the notification as hinted here.

I did not specify a "permission" key in app.json so that the FOREGROUND_SERVICE permission should be granted according to the doc.

Stack trace ``` Your app just crashed. See the error below. android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{30aa329 u0 com.paulcombal.playernative/com.tanguyantoine.react.MusicControlNotification$NotificationService} at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2002) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:225) at android.app.ActivityThread.main(ActivityThread.java:7563) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:994) ```