Status Update
Comments
ra...@google.com <ra...@google.com> #2
Any updates on this? It's been a month already since I reported it, and it seems this crash is occurring quite frequently for my users.
py...@gmail.com <py...@gmail.com> #3
I am still regularly receiving reports about this issue, and it seems it has not been addressed in the latest 1.4.0-rc01 release.
ra...@google.com <ra...@google.com> #4
Seems like a fairly easy fix on our end. I'll see to that it is fixed in 1.5.
py...@gmail.com <py...@gmail.com> #5
Sounds good! Obviously there's plenty of time, and it's not the end of the world if this doesn't happen, but it would make the library very convenient.
I read this code again:
Turns out this is only a problem if the Context doesn't come from a ContentProvider as those aren't initialized in the backup and restore case. So really, this would only be an issue if something tries to initialize the Startup library manually from a backup and restore.
ru...@gmail.com <ru...@gmail.com> #6
ru...@gmail.com <ru...@gmail.com> #7
thank you
Description
Component used: Startup Version used: 1.0.0
This is a feature request.
Initializer.create() currently passes in a Context instance which is already the Application instance. My request is to facilitate usage of app startup by making that type explicit:
Many libraries that currently use a ContentProvider for init already callhttps://github.com/androidx/androidx/blob/androidx-master-dev/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/LifecycleDispatcher.java#L43-L44
Context.getApplicationContext()
and then cast it toApplication
to be able to callApplication.registerActivityLifecycleCallbacks()
. Including Jetpacklifecycle-process
:The Startup library itself relies on a ContentProvider and already calls Context.getApplicationContext() on the context provided by that ContentProvider.
While the Android APIs make no guarantee that Context.getApplicationContext() will return the Application context here, it's 100% the case today and unlikely to ever change as it would break many libraries. So I think it'd be worth exposing the Application instance directly, i.e. take ownership of the hack as is done in other Jetpack libraries.