-
Notifications
You must be signed in to change notification settings - Fork 676
session: Avoid ForegroundServiceDidNotStartInTimeException... #2626
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
base: main
Are you sure you want to change the base?
Conversation
|
As requested earlier, a brief reasoning of the design choices:
1 is a hard fact and we can't do anything about it, 2 is more of a documentation problem and it seems external contributors can't edit those anyway, but 3 is possible to address - and it will give a concrete improvement for everyone suffering from ForegroundServiceDidNotStartInTimeException without understanding the reason, as it makes it practically impossible for the library to generate one now. I myself had ForegroundServiceDidNotStartInTimeException in Play Console because I didn't realize shouldStartForegroundService() is required, but with this patch there'd be a useful explainer instead. I also don't see any disadvantage of this patch for SDK>=31, and I consider the added sanity check on <31 an advantage because developers that don't always test on Android 12+ will still get notified about the fact their code is wrong. |
...and throw more useful exceptions instead. This will however not throw exceptions where foreground service start is not absolutely required, and keep logging warnings in these cases instead. Issue: androidx#2591 Issue: androidx#2622
|
Hi mr @marcbaechinger I’m currently facing the This issue is still happening frequently on Firebase Crashlytics. I would like to ask:
At minimum, what I need is that when this exception occurs, it should not be reported as a crash on Firebase Crashlytics. This affects real users, so any update would be very helpful. Thank you! |
No, that is sadly not possible. The root cause would have to be addressed for this, and it is often different for each individual app, there's no general library bug that causes this in 1.9.x AFAIK (previous versions did have bug #2768). What this PR does is instead make the crash clearly tell what the immediate reason for the crash (ie, no media items returned) is, so it is easier to investigate. |
|
Thanks for the insight Nick!
May I ask you a file a bug and explain in a bit more detail what you are seeing? LIke a stack trace, bug report or similar and what your idea is how it's caused? If this is about a crash in |
|
Hi, thanks for the suggestion!
Thanks again! |
...and throw more useful exceptions instead.
This will however not throw exceptions where foreground service
start is not absolutely required, and keep logging warnings in
these cases instead.
Issue: #2591
Issue: #2622
(This PR includes PR #2256 because they conflict. It would probably make sense to merge #2256 first.)