flutter-branch-io icon indicating copy to clipboard operation
flutter-branch-io copied to clipboard

In Android Not get deeplink data on First Launch

Open nividjain opened this issue 5 years ago • 13 comments

nividjain avatar Aug 21 '19 09:08 nividjain

same problem here, when the app is closed the listenToOnStartStream returns an empty callback.

Mapk26 avatar Aug 22 '19 14:08 Mapk26

please take a look at @ovidiu-anghelina's comment here.

I'm also still trying to debug this behavior, because in my case it works even when the application isn't on background before. I also tried making setupBranchIo function an async function with no luck.

blackmenthor avatar Oct 28 '19 06:10 blackmenthor

@blackmenthor Hey thanks for the plugin! Just to clarify, are you also running into the issue where branch is only initialized on resume?

danybuoy avatar Nov 15 '19 05:11 danybuoy

This plugin is awesome, but I have tried the workaround here, and it's useless. Still can't get the deep link when app cold starts. Is there any further progress?

blaizechuang avatar Nov 24 '19 15:11 blaizechuang

@blaizechuang Are you using a LauncherActivity for your flutter app?

danybuoy avatar Nov 25 '19 06:11 danybuoy

@danybuoy Yes, I did it. And I also tried to test your sample code with my branch key as the following steps:

  1. Migrate sample project to support Android X
  2. Update branch key and the scheme the same with my project
  3. Install the sample app and force close it

When I triggered the deeplink from my web site, the sample app launched but there was no deep link info on the screen. And when I triggered the deeplink again, the sample app showed the correct deeplink.

blaizechuang avatar Nov 26 '19 03:11 blaizechuang

@blaizechuang I'm getting the same issue too, I noticed that on first startup Branch.getInstance().initSession() never completes and therefore doesn't handle the link. Do you now if theres a way to get more verbose logging for branchsdk?

danybuoy avatar Nov 26 '19 07:11 danybuoy

@danybuoy It seems that enableDebugMode can get all the log and you already enable it. I will update here if there are any findings.

blaizechuang avatar Nov 27 '19 02:11 blaizechuang

Hey guys I've got some good news, I've Identified the problem and I've got a small workaround that I'm planning to further refine and include in this repo. I'm able to get branchIO links on startup now as well as generate branch links without having to background the app first.

The issue seems to be that branchIO is quite specific as to when it wants to be initialized. If you refer to the documentation provided by branch, it specifies that branch must be initialized in the onCreate of your applications class.

After adding the branch dependency to my projects build.gradle, creating an Application.kt class and registering it in the manifest (as an application) - the plugin works like a charm! I'll be further developing this workaround, so expect a PR from me in the coming weeks ;)

Note: This is for android only

danybuoy avatar Nov 29 '19 04:11 danybuoy

Any updates on this?

sydneyagcaoili avatar Dec 13 '19 15:12 sydneyagcaoili

having the same problem

bejavu avatar Dec 19 '19 10:12 bejavu

bump

bejavu avatar Jan 26 '20 15:01 bejavu

Hi @bejavu I was having the same problem and I built a plugin to use in my projects. If you want to check: https://pub.dev/packages/flutter_branch_sdk

RodrigoSMarques avatar Jan 26 '20 15:01 RodrigoSMarques