I registered a ContentProvider in AndroidManifest.xml, and the ContentProvider.onCreate() was called even before the Application.onCreate(). I don't understand this behavior, in my opinion, It's more natural that Application.onCreate() be called before any of the components in the application. Could someone tell me the timing of Application.onCreate() and other components' onCreate() gets called?
Called when the application is starting, before any activity, service, or receiver objects (excluding content providers) have been created.
onCreate() - called before the first components of the application starts. onLowMemory() - called when the Android system requests that the application cleans up memory. onTrimMemory() - called when the Android system requests that the application cleans up memory.
You can implement as many as you want, as you can see from the documentation here. To register a content provider, you need to add its corresponding <provider> tag in the Android Manifest. In most cases, however, you won't need multiple content providers. One is usually enough, as it can handle multiple tables.
According a Google's issue it's how this should work (although documentation is wrong).
There's another question that have a workarround that can help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With