[Android] Why do we recommend initializing the SDK in onStart() versus onCreate() in Android?

onCreate() is called when the Activity is first created and not when the activity is backgrounded. The Branch SDK is to be initialized every time the activity is foregrounded. If the activity is backgrounded and then foregrounded, this callback is not guaranteed to be called and hence the SDK will not be initialized.

The recommended way to initialize the Branch SDK is in onStart(). This is where you need to initialize the SDK since this callback is triggered every time the app is started whether from a cold start or a warm start. This is the callback that makes the activity visible to the user.


Did this page help you?
Filters