Reputation: 257
Is there a way in which an Android App calls the Content Provider by default on application load, and content provider calling an activity when needed.
(content provider's onCreate method
to be called on application load, instead of Activity.onCreate()
Upvotes: 1
Views: 2404
Reputation: 1007359
Content providers are automatically created when your process starts up. This is not only the default behavior -- you cannot change it AFAIK.
So, if the user launches one of your activities (e.g., from the home screen), your content provider will be created before the activity is called with onCreate()
.
Or, if some third-party app tries to use your content provider, Android will set up your process and create your content provider before passing the request (e.g., query()
on to you).
Upvotes: 5