According to the Official documentation
onCreate() method of the content provider is called by Android's system call immediately after it creates the provider. And since the provider isn't created until a ContentResolver object tries to access it. How my onCreate is getting called before I tried accessing it using contentResolver? (Note: I am not even accessing the provider still its onCreate getting called)
The documentation for
Provider.onCreate()that you linked to explicitly states:So Android will call
onCreate()on all content providers immediately on application launch. Obviously it cannot callonCreate()until the content provider is instantiated, so that means that immediately on application launch, Android will instantiate all content providers and callonCreate()on all of them.Your application will have to deal with this appropriately.