-
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 app not getting correct deeplink from Branch when app is opened #283
Comments
I didn't understand. "Branch SDK returning random deeplinks when multiple deeplinks are clicked in a few seconds innerval" Is this an expected scenario? Too many clicks? at intervals of how long? Can you send a video demonstrating the problem? |
@RodrigoSMarques thanks for looking into it. Screen recording: https://drive.google.com/file/d/1lzX4gY5mi0Ee868JFm6Z9U6zJvU461OK/view?usp=sharing I think the issue is - let's say there are 3 deeplinks A, B and C. If the app is already in the background and if I tap on link A it just opens the app but app not getting the exact deeplink. Now if I tap on the deeplink B, Branch is returning deeplink A. Now if I tap on C, app is getting B from Branch. |
@RodrigoSMarques thanks for your help, could you please help how we can fix it? |
I was unable to reproduce the issue. I recorded the attached video, carrying out tests with the example application and there were no problems recovering data from the links. https://drive.google.com/file/d/1v9usGt1brmH8AvsbvsZD1rGoVTXIGIxA/view?usp=sharing I have included a timestamp in the link data to identify the correct retrieval. What does the below line of code do? It cannot be causing any delay in your application _firebaseAnalyticsService.logBranchData(data); |
Did you identify something in your code? |
Same here, but doesn't work only on the release mode |
+1 to this and thank God I thought only I'm facing this issue. @RodrigoSMarques this issue is a consistent repro if you test using a released version of the app which is already in Google play store. If possible could you please upload your test app in Google play store and try from that? |
Yeah, tried , didn't work the release beta from google play store. Simply downgraded to 6.9.0, until they fix the issue |
I am not sure yet about "links A, B, C" stuff, but I noticed that indeed sometimes links with data on android aren't being tracked, when app is open. They do work when clicking with app closed. On iOS it's not the issue, so I assume the listener is setup correctly in flutter code. So either android config is broken, or the problem in plugin/branch.io internals. |
Have you completed SHA256 Cert Fingerprints on the dashboard? |
Yep, Android App Links work as intended, without browser redirection. Google Play verified the domains and their |
I'm working on another app to upload to the store and test. This plugin is just a layer with the Native SDK. It is difficult to identify whether the problem is in any call in the plugin or in the SDK under any specific conditions. |
@nzackoya |
The question was for @nzackoya I don't understand what your case @romatallinn |
@RodrigoSMarques I was replying to romatallinn's question. For you this one #283 (comment) |
I see lot of confusion in this thread of who replies to what haha. 😅 Just to wrap up what was wrong in my setup. Maybe will be helpful to somebody. Android's launchModeIt's sort of a non-trivial concept in android, so hard to explain in short. My app does a lot of stuff via WhatsApp. By default, Flutter uses Bug in initializationSort of a more of a trivial bug on my side. I have a splash screen with some setup and initialisation procedures. And branch init ended up being in a clause that aren't awaited completion, so they can be loaded in background even after splash screen. But the branch listener was right after the splash. So sometimes -- not always -- the branch wasn't init'ed at the moment of starting listening to links, so the ones used in opening the app were missed. Just ensuring that branch init is completed before starting the listener helped. |
@RodrigoSMarques I am using flutter_branch_io : 6.9.0 , and in my ios app it is working fine when in clicked on the link , but on android when the app is already opened and then i click on the link it opens another window of the same app but gives the data on the previous window (on Pixel 6a). |
You must update your AndroidManifest.xml `android:launchMode="singleTask"`` The previous answer is the explanation of this. |
I had similar issue. When tap on the link and app is running in background then the app correctly is being brought to foreground but navigation does not happen. I did some investigation and noticed that following warning appear only on release builds
It turned out I forgot to configure one of the steps related to pro guard https://help.branch.io/developers-hub/docs/android-basic-integration#7-configure-proguard After applying ProGuard rules my android app now open links correctly from background state. I am pretty sure that there is race condition somewhere in FlutterBranchSDK and/or BranchSDK, so proguard configuration rather hides symptoms not fixing the real issue |
Tbh, I still have some problems. I cannot reproduce it myself. Tried different phones, android versions, emulator. It is always working fine for me. But some of our users have this behaviour, when the app is brought to focus, but the link is not detected. I don't know if it's the problem of the package, or branch io native implementations. No issues caught by Sentry. I logged some things manually to see how the code flows: when the app is opened, the listener reads empty @shorben07 I do have proguard config, which doesn't help me at the moment, but I copied it over from example project here, not branch docs. And I just noticed that there is a difference with what branch io dictates. Note I will try changing it and see if it helps. |
@shorben07 can you please share your current proguard? Is it just one line that official branch docs says: or something else? |
My proguard is:
In my case I had issue probably because I have three different packages for deep links working side by side:
I already fixed something similar for iOS joylabs@c824d3f where Dynamic Links SDK breaks logic of Branch SDK Plugin and also only in release mode. |
Here are logs from my app:
Release mode where navigation does not happen
As you can see no exceptions or errors, so that is why you don't see anything in the Sentry but in the end you get
|
The example project's proguard settings may be outdated and inconsistent. Use the instructions recommended by Branch. I don't have experience with pro-guard to know if there is a difference in syntax. |
This solution is interesting. I will add a new method in the plugin to configure hosts that should be ignored by the SDK. I believe this solves the problem of this issue here: #296 Why did you add the line below?
This library is used by the plugin to monitor Activity state changes. It is responsible for notifying the SDK that the application has moved to the foreground and thus recovering the data from the clicked link. |
Checking your log, I see that Native SDK (BranchSDK) commands are the majority of the result. The native SDK is responsible for identifying the links, retrieving the data and the Flutter plugin receives the result. I suggest opening an issue in the Android repository, detailing your case and with the log for analysis. |
DefaultLifecycleObserver is unrelated to BranchSDK and was added earlier for some other plugin to work correctly. I posted the whole file with my proguard rules. |
Hi guys. I believe I have identified the problem. I'm already working on the next version. It will be made available in the next few days. |
Hey guys. Version 8.0.0 released. Take the tests and report the results. |
Now, I cannot get any link when I open the app - since onInitFinished on Android side is not called at all. See this ticket - #325 |
Closed. No activity/response in the last 15 days. |
Describe the bug
Android app is not getting correct deeplink from Branch when app is already opened. If I try to open multiple deeplinks Branch sending random deeplinks. This issue is only happening in Android and so far I didn't notice any issue in iOS. Also can’t repro this issue when launching the app from VS Code for debugging, but if I use build from the play store then can repro it.
To Reproduce
Expected behavior
When app is already opened, app should receive the correct deeplink from Branch SDK.
Smartphone (Please complete the following information. remove session if not platform):
Android OnePlus 8T, OS 13
Flutter Version: Flutter (Channel stable, 3.13.1, on macOS 13.5.1 22G90 darwin-arm64, locale en-US)
flutter_branch_sdk: ^7.0.2
Issue only reproducible in Android, iOS looks fine.
The text was updated successfully, but these errors were encountered: