-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash because of the foreground service did not start in time #112
Comments
I have the same issue in my app (at least I can see it in crashlytics).
|
Some context: This error indicates that Context.startForegroundService() was called but Service.startForeground() was not called soon enough. The Android docs say that the second should be called within
so let's say that's 5 seconds. In beta01,
If you don't let the library post notifications, e.g. you override If the library is posting notifications, then my investigation starting point would be if the user tapped play on the notification (1) but for some reason the player did not start playback within 5 seconds, so that the control flow reaches (2) after 5 seconds or never. This could happen if the app's main thread was busy executing other code for 5 seconds between tapping the play icon and starting playback. Or, the app has logic such that even when the play button is pressed on the notification, playback does not start, in which case (2) does not happen. Is there a case that anything of the above is happening in your app? |
Hi @christosts, thanks for your explanation. We don't override the the I don't think there is a valid way in our app where the playback doesn't start within 5 seconds (except the internet connection is down and the exoplayer can not load the next media item from the web but I think this shouldn't be a problem here). But I looked at the crashlog again and the crash is always direct at the beginning. So the app starts and 5 seconds later it will crash. So maybe there is some ANR at our app start which prevents foreground service. I will look a bit deeper into it. |
I have the same problem, it crash 10 times in a row, about ten seconds apart, the Crashlytics tell me they are all in the background. This information may be helpful. |
I spotted a bug that occurs after the player has finished playback. The notification still shows a pause button (which does nothing) and the I don't think this is the root cause for the exceptions you are seeing reported, but I'm going to link the commit to this issue anyway since I spotted it while investigating this issue. Thank you for reports and for helping us. |
We have the same issue on WearOS, all Android 11: Dont have much more info but its early in the application start |
Is this related #167? |
Media3 Version
1.0.0-beta01
Devices that reproduce the issue
Google Pixel 6, Android 13
Samsung Galaxy A32 5G, Android 12
Samsung Galaxy A13 5G, Android 12
Xiaomi POCO X3 Pro, Android 12
Samsung Galaxy A12, Android 11
Samsung Galaxy A10s, Android 11
Devices that do not reproduce the issue
Can't reproduce manually, got those stats from Crashlytics. Not sure how we can deal with this crash, do you have any idea why this crash may happen?
Reproducible in the demo app?
Not tested
Reproduction steps
We extended our playback service by your
MediaSessionService
, the crash happened approximately 70% in the background (stats in Crashlytics), we can't manage to reproduce it in any way.Expected result
Actual result
There are several types of exception grouped by the Android OS, but the reason looks exactly the same
Android 11
Android 12
Android 13
Media
Nothing particular, just normal audio streaming
Bug Report
adb bugreport
to [email protected] after filing this issue.The text was updated successfully, but these errors were encountered: