@@ -32,8 +32,6 @@ class BranchLinkSimulatorApplication: Application() {
3232
3333 roundTripStore = RoundTripStore (this )
3434 Branch .enableLogging(roundTripStore)
35- // Branch object initialization
36- // Branch.getAutoInstance(this, currentConfig.branchKey)
3735
3836 // Retrieve or create the bls_session_id
3937 val sharedPreferences = getSharedPreferences(" branch_session_prefs" , Context .MODE_PRIVATE )
@@ -42,13 +40,10 @@ class BranchLinkSimulatorApplication: Application() {
4240 sharedPreferences.edit().putString(" bls_session_id" , newId).apply ()
4341 newId
4442 }
45- Log .d(" AppScopeTest" , " Application Fired launching coroutine" )
4643 applicationScope.launch {
47- Log .e( " AppScopeTest " , " Coroutine Successfully fired " )
44+ // Coroutine used to move creating the Branch singleton through Branch.getAutoInstance() to background thread
4845 setupBranchInstance(this @BranchLinkSimulatorApplication, currentConfig.branchKey)
49-
5046 withContext(Dispatchers .Main ) {
51-
5247 // Set the bls_session_id in Branch request metadata
5348 Branch .getInstance().setRequestMetadata(" bls_session_id" , blsSessionId)
5449 }
@@ -62,6 +57,7 @@ class BranchLinkSimulatorApplication: Application() {
6257
6358 suspend fun setupBranchInstance (context : Context , branchKey : String ) {
6459 withContext(Dispatchers .IO ) {
60+ // Branch object initialization
6561 Branch .getAutoInstance(context, branchKey)
6662 }
6763 branchInitializationSignal.complete(Unit )
0 commit comments