-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android cannot get the opening link (onInitFinished called after clicking on deep link two times) #325
Comments
Create a file called {
"deferInitForPluginRuntime": true
} Place this file in the path:
Retake the test. |
Are You calling: |
Thanks for the fast reply - I cannot see this "deferInitForPluginRuntime" int Readme, should I still call - await FlutterBranchSdk.init(); or not after creating this file? |
You shouldn't create this file as it is included in the SDK. That's why there are no instructions about it in README.MD I did several tests, but it may be that in your project for some reason at build time, this file was deleted, that's why I asked you to create it. Yes. You must still call the await function If not called, |
Only |
I understand, I added it manually now - and I await FlutterBranchSdk.init(); in main - but I have still the same issue - do you have any idea how to check is this file loaded properly. All other things are working well - just first link is missed. |
Logs: D/FlutterBranchSDK( 8234): triggered onActivityPaused: rs.operi.app.MainActivity |
Also, after tapping deep link a lot of times - I get this thing logged again Branch SDK logged this D/FlutterBranchSDK( 3719): BranchReferralInitListener - params: {"+non_branch_link":"dev-operi-app://open?link_click_id=1304070486333205728","+clicked_branch_link":false,"+is_first_session":false} It's from this issue #308 So looks like I have serious problems with the library on my phone/project |
It's very weird. Looking at your log, the behavior is correct. I shouldn't be missing the link. I made a change to the code. Update pubspec.yaml, as in the example below:
|
Still the same - I tried now on different device - Google Pixel - so nothing changes. On previous versions of your lib I forked your repo and fixed this issue - but I am not so good in Java - so I made everything dirty (you can disregard part for "intercom"), can you please take a look at this commit and see what can be the problem - since with this commit it was capturing the initial link - operi-rs/flutter_branch_sdk@68de901 But I think startActivity was the solution there in setup method. Anyways I dont want to use my fork since I made it by guess, making everything confusing.. |
The only difference in ny project is that besides MainActivity, I have one more FlutterFragmentActivity defined for support chat (intercom_flutter) plugin, but it should not make any sense, because your plugin attached to MainActivity (see logs) |
Does your |
If it's |
FlutterFragmentActivity - I needed to do that brcause of the intercom_flutter plugin Sorry for the previous message - I mixed up something in my mind, so this is the only activity class I have, and intercom_flutter is creating another activity when I launch live chat support - but all these tests I've performed were unrelated to this (I was not opening support chat). So you have full context now. The fork commit I provided in the last message I did for 2 different reasons:
I would be very grateful if you can provide an official fix
|
I already know what the problem is. I will release a new version later. |
The infinite loop will also be fixed in this version |
Amazing! You are the man! |
### 🐛 Bug Fixes * Fix issue #325: Android cannot get the opening link (onInitFinished called after clicking on deep link two times)
Version 8.0.1 available |
Hey, thanks for releasing. Looks like onInitFinished is called now, but since I've disabled tracking, I've got this log: BranchReferralInitListener - error: Trouble initializing Branch. Tracking is disabled. Requested operation cannot be completed when tracking is disabled I just want to use deep linking feature from Branch, without tracking. Additionally, when I wanted to test with tracking enabled by calling this method without disableTracking parameter set (default value is "false")
I got the same message - BranchReferralInitListener - error: Trouble initializing Branch. Tracking is disabled. Requested operation cannot be completed when tracking is disabled So two things:
When I deleted the app - and cleaned the project - I was able to set trackingDisabled = false again - and deep links are working perfect! |
Also reporting here some minor thing - which is not breaking anything basically - but it is in the console output when using "Hot Restart" Flutter feature: W/System.err(24038): java.lang.IllegalStateException: Reply already submitted This is not important at all - but you should be informed |
In the plugin I only treated the case of But everything indicates that the native SDK stores some preference to know whether the app should be launched with tracking or not. Once you have disabled tracking, you need to explicitly enable it with I will evaluate, so that in init I can change it to true or I do it at each startup. |
Hot Restart should not kill the native code that is running, initializing it again. Unfortunately, in Hot Restart, this cannot be resolved. |
Yeah, but you cannot use plugin when Tracking is disabled. So plugin crashes always with error - "BranchReferralInitListener - error: Trouble initializing Branch. Tracking is disabled. Requested operation cannot be completed when tracking is disabled" I don't want to use tracking at all - but it shouldn't prevent me to have this plugin for deep link purposes - this is the main problem. I have just one initialization line - Regarding trackingDisabled: false - I just mentioned that as an example - but I don't plan to use the plugin for Tracking - just for deep linking. |
This message is returned by the native SDK. I have no control over the plugin code in relation to this. In this case, I suggest opening an issue in the Branch SDK Android repository. |
Check the links: BranchMetrics/ios-branch-deep-linking-attribution#1029 https://help.branch.io/developers-hub/docs/honoring-opt-out-of-processing-requests https://help.branch.io/developers-hub/docs/android-full-reference public void disableTracking(boolean disableTracking) Method to change the tracking state. If disabled, the Branch Android SDK will not track any user data or state. The SDK will not send any network calls, except for deep linking, when tracking is disabled. |
I saw a lot of similar issues reported - but they've never took any action. So looks like, I need to initialize the plugin with tracking enabled and then to explicitly disable it in the next line of code. Because otherwise initialization will fail. |
Thanks a lot for the update - we can close this issue! |
I identified that the plugin in the init method will call disableTracking(true) if the value is true. if the value is false the plugin does not call disableTracking(false). I will adjust this in a new version. |
Describe the bug
Using new version 8.0.0, onInitFinished is not called when application is opened. It doesn't make any difference if it's opened by clicking on deep link or opened via launcher icon.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
ListSession should return opening deep link or "null" if app is opened using launcher icon.
Smartphone (Please complete the following information. remove session if not platform):
Additional context
When I click on deep link again, onInitFinished is called and deep link is received in listSession stream - so just the first link is always missed :(
The text was updated successfully, but these errors were encountered: