RodrigoSMarques / flutter_branch_sdk

Flutter Plugin for create deep link using Branch Metrics SDK. This plugin provides a cross-platform (iOS, Android, Web).
https://branch.io
MIT License
101 stars 91 forks source link

"-118, Warning. Session initialization already happened" triggered in the listSession callback #368

Closed synstin closed 3 months ago

synstin commented 3 months ago

Describe the bug I'm experiencing the same issue as described in this GitHub issue. It occurs only for Android users and happens very frequently. I'm currently using version 8.1.0, and the singleTask attribute is already set.

FlutterBranchSdk.listSession().listen(...) is initialized only once when the app starts. Despite this logic not being called multiple times, I am still encountering the error "Session initialization already happened."

Mobile

Additional context

PlatformException(-118, Warning. Session initialization already happened. To force a new session, set intent extra, "branch_force_new_session", to true., null, null)
RodrigoSMarques commented 3 months ago

This error message is returned by the Branch SDK.

I have no control over it.

Some other plugin is forcing the Branch SDK to initialize before the plugin starts.

This is not a solution to the problem, but it is a workaround. I will implement the guidance as described here.

I will soon make a new version available

0aps commented 3 months ago

hey @RodrigoSMarques , following the workaround that you mentioned, have you been able to catch that exception from the Dart layer? I have a try-catch (around the flutter branch.io sdk init and listSession methods) of PlatformException but it doesn't seem to be catching the exception ...

RodrigoSMarques commented 3 months ago

hey @RodrigoSMarques , following the workaround that you mentioned, have you been able to catch that exception from the Dart layer? I have a try-catch (around the flutter branch.io sdk init and listSession methods) of PlatformException but it doesn't seem to be catching the exception ...

I have never been able to reproduce this error.

RodrigoSMarques commented 3 months ago

Fix Release 8.1.1