ActivityThread.generateForegroundServiceDidNotStartInTimeException on Android 13
@tianyif is already working on this.
Since May 15, 2023.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 955
- Avg merge
- 12d 14h
- Merged PRs (30d)
- 2
Description
Media3 Version
Media3 1.0.0-rc02
Devices that reproduce the issue
- Samsung running Android 13(99% of crashes happens with Samsung running Android 13;
- Pixel 7 Pro running Android 13;
- Pixel 6 running Android 13;
- Oppo A74 5G running Android 13
Devices that do not reproduce the issue
All devices running Android 12 and below
Reproducible in the demo app?
Not tested
Reproduction steps
Some of our users get this exception randomly when use our app. This is very strange because users can get this crash even if they close player activity. We use MediaSessionService and after user closes player activity we call stopService methos inside onDestroy() in our activity:
override fun onDestroy() {
stopService(Intent(this, MoviePlayerService::class.java))
super.onDestroy()
}
After user exits player activity sometimes app could crash with ActivityThread.generateForegroundServiceDidNotStartInTimeException, which is strange because our service is already stopped. This crash happens only on devices running Android 13(mainly on Samsung). So my question is: is it a bug with Media3, or problems with several devices, or we just incorrectly stop MediaSessionService? Crash happens randomly and we don't know concrete steps to reproduce it.
Expected result
App shouldn't crash and media should work successfully
Actual result
After closing player screen users could get the crash in random moment
Media
Not applicable
Bug Report
- You will email the zip file produced by
adb bugreportto dev.exoplayer@gmail.com after filing this issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.