react-native-branch-deep-linking-attribution icon indicating copy to clipboard operation
react-native-branch-deep-linking-attribution copied to clipboard

SDK stops functioning completely on Android until next app launch if there is an error

Open evelant opened this issue 3 years ago • 1 comments

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:

  1. Start app with internet connection disabled
  2. branch.subscribe returns error poor network connectivity. please try again later
  3. Re-enable internet connection -- nothing happens, callback is not called again now that we're online
  4. call the unsubscribe function
  5. call branch.subscribe again -- nothing happens, callback is never called
  6. call getLatestReferringParams or getFirstReferringParams -- both return an empty object instead of throwing an error
  7. There is now no way to "try again later", the SDK is non functional even though we're online!
  8. Background the app and foreground it again by pressing app switcher key
  9. 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.

evelant avatar Jun 24 '21 15:06 evelant

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

evelant avatar Jun 24 '21 15:06 evelant