Open elliotdickison opened 8 months ago
It seems to me that Android 14 is making this issue worse. I was seeing this error but way less than the previous one, but it seems that this new one is increasing after Android 14.
we're currently with RC08 in production and we hope to release a new version of our app until the end of this week with final version 4 of the library
we have the same problem on android 14. :(
seems very similar to the flutter folks experiencing, related to battery optimization https://github.com/ryanheise/audio_service/issues/994
Hi everyone, just wanted to kindly ask you if you made any progress on this issue, thanks in advance.
I’m seeing the exact same crash reports while using version 4.0.1
Also happening on prod using > "react-native-track-player": "^3.2.0-7b02a2d2a51370819b91ea8da1fe835a617c3199",
Caused by java.lang.SecurityException: Starting FGS with type mediaPlayback targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK]
at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
at android.os.Parcel.createException(Parcel.java:3041)
at android.os.Parcel.readException(Parcel.java:3024)
at android.os.Parcel.readException(Parcel.java:2966)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:6761)
at android.app.Service.startForeground(Service.java:775)
at com.doublesymmetry.trackplayer.service.MusicService.startAndStopEmptyNotificationToAvoidANR(MusicService.kt:115)
at com.doublesymmetry.trackplayer.service.MusicService.onStartCommand(MusicService.kt:92)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4821)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2289)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
track-player 4.0.1 - [ google husky (Pixel 8 Pro) ] - [ Android 14 (SDK 34) ]
Exception java.lang.RuntimeException:
at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:5261)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2447)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:226)
at android.os.Looper.loop (Looper.java:313)
at android.app.ActivityThread.main (ActivityThread.java:8762)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)
Caused by android.app.ForegroundServiceStartNotAllowedException:
at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel (ForegroundServiceStartNotAllowedException.java:54)
at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel (ForegroundServiceStartNotAllowedException.java:50)
at android.os.Parcel.readParcelableInternal (Parcel.java:4787)
at android.os.Parcel.readParcelable (Parcel.java:4755)
at android.os.Parcel.createExceptionOrNull (Parcel.java:3018)
at android.os.Parcel.createException (Parcel.java:3007)
at android.os.Parcel.readException (Parcel.java:2990)
at android.os.Parcel.readException (Parcel.java:2932)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground (IActivityManager.java:6991)
at android.app.Service.startForeground (Service.java:743)
at com.doublesymmetry.trackplayer.service.MusicService.startAndStopEmptyNotificationToAvoidANR (MusicService.kt:123)
at com.doublesymmetry.trackplayer.service.MusicService.onStartCommand (MusicService.kt:98)
at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:5243)
Involved Devices:
Just got same on Pixel 7 on Android 14
Also seeing this with v4.0.1 — any thoughts on cause, workaround?
EDIT: I just released an app update that uses TrackPlayer and:
ping - anythoughts?
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Not stale, still happening frequently. Just haven’t had time to investigate further yet.
any solution for this folks ?
This is still an issue AFAIK, @nateshmbhat I'm sure the maintainers would welcome a PR!
Our best guess so far as to the scenario under which this occurs:
Describe the Bug
We recently released
3.2.0-b13a92208eaf9607a12cfa7596dfa6ae4f4a4c8e
into production to take advantage of some of the updated Android foreground service logic (thank you!). We saw the long-timeandroid.app.ForegroundServiceStartNotAllowedException
bug disappear completely (woohoo!) but this one started popping up at about the same frequency. The issue only occurs in the background. This seems closely related to #1986, but per the discussion on that issue I'm opening a new issue.Steps To Reproduce
We have yet to reproduce locally on our devices. We have tried forcing the device into doze mode, loading new tracks in the background, playing for extended periods of time, etc. The issue is happening with regular frequency in production with an install base of ~6K
Code To Reproduce
Use
3.2.0-b13a92208eaf9607a12cfa7596dfa6ae4f4a4c8e
Replicable on Example App?
We have yet to reproduce the issue even in our app, once we do we'll check the example app.
Environment Info:
react-native-track-player@3.2.0-b13a92208eaf9607a12cfa7596dfa6ae4f4a4c8e
How I can Help What can you do to help resolve this? Have you investigated the underlying JS or Swift/Android code causing this bug? Can you create a Pull Request with a fix?