react-native-branch-deep-linking-attribution
react-native-branch-deep-linking-attribution copied to clipboard
SDK stops functioning completely on Android until next app launch if there is an error
Related to https://github.com/BranchMetrics/react-native-branch-deep-linking-attribution/issues/658
The SDK stops functioning completely on Android until the next time the app is foregrounded if there is an error in branch.subscribe
. For example:
- Start app with internet connection disabled
-
branch.subscribe
returns errorpoor network connectivity. please try again later
- Re-enable internet connection -- nothing happens, callback is not called again now that we're online
- call the unsubscribe function
- call
branch.subscribe
again -- nothing happens, callback is never called - call
getLatestReferringParams
orgetFirstReferringParams
-- both return an empty object instead of throwing an error - There is now no way to "try again later", the SDK is non functional even though we're online!
- Background the app and foreground it again by pressing app switcher key
- subscribe callback fires twice (unsubscribe didn't work, memory leak) with success
This behavior means that if an error happens in branch.subscribe
that the branch SDK is effectively dead for the rest of the user's session. There is no way to handle an error or retry any operation, no way to prompt to the user to go online to try again.
Hmm it looks like the branch sdk is using the deprecated DeviceEventEmitter API -- deprecated 5 years ago! Perhaps that's part of the issue with unsubscribe not working.
https://stackoverflow.com/questions/58285364/react-native-deviceeventemitter-unsubscribe-from-event