- 
                Notifications
    You must be signed in to change notification settings 
- Fork 142
Description
Describe the bug
In my app, I'm calling Branch.initSession().then(callBack) in both onDeviceReady and onDeviceResume.
When called from onDeviceResume, it works as expected and the callBack is called. However, when called from onDeviceReady, the callBack is not called. This is causing deeplinks to not work as expected from app launch, and only on app resume.
Investigation findings:
- from onDeviceReady, initSession from within the BranchSDK.java is being called and correctly and it is initialising. Runs through the end of the function with no errors. However, the callBack is not triggered.
- If I put the app to background and return, the callBack from onDeviceReady's initSession is called (discovered this by commenting outonDeviceResume's initSession)
- If I try to call initSession again from onDeviceReady, it throws: "Warning. Session initialization already happened. To force a new session, set intent extra, "branch_force_new_session", to true."
Any idea what might be the cause? I suspect the callBack might be getting stuck somewhere.
Steps to reproduce
- Add Branch.initSession with callback function to both onDeviceReady and onDeviceResume
- Build and launch on Android
- Check if callback function is run
Expected behavior
The callback function should be called on both onDeviceReady and onDeviceResume after Branch.initSession
SDK Version
branch-cordova-sdk 6.5.1
Make and Model
Samsung Galaxy S24 Ultra
OS
Android 15
Additional Information/Context
I removed <preference name="deployment-target" value="12.0" /> from the plugin.xml as it conflicts with cordova firebasex, but that's for iOS and shouldn't affect this.