Closed HudsonProenca-sf closed 7 months ago
According to the error message, you are initializing the listSession
method once again in your code, causing multiple SDK listen initializations.
When is initSession
called in your code?
On Android, according to the Activity lifecycle, the listSession
method will return results, even when no link is clicked. This is the behavior of the Branch SDK.
You should check if the result has +clicked_branch_link
According to the error message, you are initializing the listSession method once again in your code, causing multiple SDK listen initialization. When is initSession called in your code?
We are calling it one time when the app first started.
You should check if the result has +clicked_branch_link
The issue is that we are not receiving the issue as data, so we can't check the +clicked_branch_link
. This is thrown on the onError of the stream, which only contains the PlatformException information
In AndroidManifest.xml
the property android:launchMode
="singleTask"
?
In
AndroidManifest.xml
the propertyandroid:launchMode
="singleTask"
?
Yes
@HudsonProenca-sf
Which WebView plugin is being used?
Can you replicate the problem in debug mode?
If so, is it possible to send debug messages from the FlutterBranchSDK plugin?
Which WebView plugin is being used?
I'm using webview_flutter webview_flutter: ^4.2.2 webview_flutter_wkwebview: 3.5.0 webview_flutter_android: ^3.8.1 webview_flutter_platform_interface: ^2.1.0
Can you replicate the problem in debug mode?
Yes, we could reproduce it in debug mode on Android
If so, is it possible to send debug messages from the FlutterBranchSDK plugin?
What do you mean?
What do you mean? In logcat/console, filter all messages with the text "FlutterBranchSDK", from application startup until the time the error occurs.
@RodrigoSMarques The sad part is that we are not currently able to reproduce it again. We are going to keep an eye on it and if we see it again we will try to get more information to you.
@RodrigoSMarques Here is more information about when the error happened from the native logging
D/FlutterBranchSDK( 5744): triggered onAttachedToEngine
D/FlutterBranchSDK( 5744): triggered setupChannels
D/FlutterBranchSDK( 5744): triggered onAttachedToActivity
D/FlutterBranchSDK( 5744): triggered setActivity
D/FlutterBranchSDK( 5744): triggered setRequestMetadata
D/FlutterBranchSDK( 5744): triggered setupBranch
D/FlutterBranchSDK( 5744): triggered onNewIntent
D/FlutterBranchSDK( 5744): triggered SessionBuilder reInit
D/FlutterBranchSDK( 5744): triggered onListen
D/FlutterBranchSDK( 5744): triggered logout
D/FlutterBranchSDK( 5744): triggered onInitFinished
D/FlutterBranchSDK( 5744): BranchReferralInitListener - params: {"+clicked_branch_link":false,"+is_first_session":true}
D/FlutterBranchSDK( 5744): triggered onActivityStarted
D/FlutterBranchSDK( 5744): triggered SessionBuilder init
D/FlutterBranchSDK( 5744): triggered onInitFinished
D/FlutterBranchSDK( 5744): BranchReferralInitListener - error: Warning. Session initialization already happened. To force a new session, set intent extra, "branch_force_new_session", to true.
D/FlutterBranchSDK( 5744): triggered onActivityStopped
D/FlutterBranchSDK( 5744): triggered onActivityStopped
D/FlutterBranchSDK( 5744): triggered onActivityStarted
D/FlutterBranchSDK( 5744): triggered SessionBuilder init
D/FlutterBranchSDK( 5744): triggered onActivityStarted
D/FlutterBranchSDK( 5744): triggered SessionBuilder init
D/FlutterBranchSDK( 5744): triggered onInitFinished
D/FlutterBranchSDK( 5744): BranchReferralInitListener - error: Warning. Session initialization already happened. To force a new session, set intent extra, "branch_force_new_session", to true.
D/FlutterBranchSDK( 5744): triggered onActivityStopped
D/FlutterBranchSDK( 5744): triggered onActivityDestroyed
D/FlutterBranchSDK( 5744): triggered onActivityDestroyed
D/FlutterBranchSDK( 5744): triggered onInitFinished
D/FlutterBranchSDK( 5744): BranchReferralInitListener - params: {"+non_branch_link":"<app name>:\/\/authorizationSuccess?code=<some code>","+clicked_branch_link":false,"+is_first_session":false}
I need more information about how the webview_flutter plugin is used in your project.
What is the purpose of use? How is the code implemented?
I added this package to the example project and calling the webview the project's behavior was not changed.
I believe that your project has some very specific code implementation.
The log snippet below is strange
D/FlutterBranchSDK( 5744): triggered onInitFinished
D/FlutterBranchSDK( 5744): BranchReferralInitListener - params: {"+clicked_branch_link":false,"+is_first_session":true}
D/FlutterBranchSDK( 5744): triggered onActivityStarted
D/FlutterBranchSDK( 5744): triggered SessionBuilder init
D/FlutterBranchSDK( 5744): triggered onInitFinished
D/FlutterBranchSDK( 5744): BranchReferralInitListener - error: Warning. Session initialization already happened. To force a new session, set intent extra, "branch_force_new_session", to true.
D/FlutterBranchSDK( 5744): triggered onActivityStopped
D/FlutterBranchSDK( 5744): triggered onActivityStopped
Whenever the Android activity is brought to the foreground, the onActivityStarted
method.
When the Android activity is placed in the background, the onActivityStopped
method is called.
Before onActivityStarted
, there should have been onActivityStopped
.
There are two `onActivityStopped being called in sequence.
This shouldn't happen.
This is the example application log, entering the foreground, then going to the background and returning to the foreground.
br....es.flutter_branch_sdk_example D triggered onAttachedToEngine
br....es.flutter_branch_sdk_example D triggered setupChannels
br....es.flutter_branch_sdk_example D triggered onAttachedToActivity
br....es.flutter_branch_sdk_example D triggered setActivity
br....es.flutter_branch_sdk_example D triggered onActivityStarted
br....es.flutter_branch_sdk_example D triggered setupBranch
br....es.flutter_branch_sdk_example D triggered onNewIntent
br....es.flutter_branch_sdk_example D triggered SessionBuilder reInit
br....es.flutter_branch_sdk_example D triggered onInitFinished
br....es.flutter_branch_sdk_example D BranchReferralInitListener - params: {"+clicked_branch_link":false,"+is_first_session":false}
br....es.flutter_branch_sdk_example D triggered onListen
br....es.flutter_branch_sdk_example D triggered onActivityStopped
br....es.flutter_branch_sdk_example D triggered onActivityDestroyed
br....es.flutter_branch_sdk_example D triggered onDetachedFromActivity
br....es.flutter_branch_sdk_example D triggered onDetachedFromEngine
br....es.flutter_branch_sdk_example D triggered teardownChannels
br....es.flutter_branch_sdk_example D triggered onAttachedToEngine
br....es.flutter_branch_sdk_example D triggered setupChannels
br....es.flutter_branch_sdk_example D triggered onAttachedToActivity
br....es.flutter_branch_sdk_example D triggered setActivity
br....es.flutter_branch_sdk_example D triggered onActivityStarted
br....es.flutter_branch_sdk_example D triggered setupBranch
br....es.flutter_branch_sdk_example D triggered onNewIntent
br....es.flutter_branch_sdk_example D triggered SessionBuilder reInit
br....es.flutter_branch_sdk_example D triggered onInitFinished
br....es.flutter_branch_sdk_example D BranchReferralInitListener - params: {"+clicked_branch_link":false,"+is_first_session":false}
br....es.flutter_branch_sdk_example D triggered onListen
I noticed that you are in Brazil. Let's speak in Portuguese to facilitate communication
@HudsonProenca-sf
Run a test with version 7.2.0 which was released today.
I made an adjustment to the code, when initializing the SDK, which, if my analysis is correct, could resolve the error.
@RodrigoSMarques
That's great!
I'll update to the latest version and keep you updated. Thanks.
Closed. No activity in the last 14 days. If necessary open again.
@RodrigoSMarques ,
This is still happening to me on version 7.3.0. Same error, same issue from Sentry.
Any suggestions?
@RodrigoSMarques ,
This is still happening to me on version 7.3.0. Same error, same issue from Sentry.
Any suggestions?
In AndroidManifest.xml the property android:launchMode="singleTask" ?
@RodrigoSMarques yes.
@RodrigoSMarques any clue? still happening to me in the latest version?
@RodrigoSMarques any clue? still happening to me in the latest version?
Have you updated to the latest version 8.0.x? Have you performed any tests?
@RodrigoSMarques
I am currently using version 8.1.0, and the same issue frequently occurs.
The singleTask
has been added.
Describe the bug We are seeing a lot of -118 errors when listening to the
listSession
stream. The weird part is that it is triggered sometimes even without the user having clicked on a Branch deep link. Also, it looks like an initialization error, but we are not trying to initialize again, the user has just opened the app, and then Branch throws this issuee.g
To Reproduce I couldn't reproduce exactly this issue, we've been seeing this issue in Sentry. Some of our team mates identified this issue while opening and closing a web view.
Expected behavior We shouldn't see an initialization error while listening to Branch deep links. Branch should not trigger an issue to that stream if the user has not clicked on a branch link.
Screenshots
Smartphone (Please complete the following information. remove session if not platform):