Skip to content

Accessing application context before app has been launched #8382

Closed Answered by brettchabot
MikeEA0 asked this question in Q&A
Discussion options

You must be logged in to vote

Would making use of a https://developer.android.com/reference/androidx/test/runner/lifecycle/ApplicationLifecycleCallback work for this case? You can get a callback before Application.onCreate happens, and get passed an Application object.

This approach would work for android instrumentation tests as well.

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by utzcoz
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants