I have created a Dynamic Link
in Firebase Console. I have Refer option in Application, which creates a Dynamic Link and the link is share through some media. As per Firebase documentation, if app is not installed already it opens Play Store and enable user to download the app. But once the app is downloaded, (as per documentation) it should show Continue
option to open the app for first time so that expected Dynamic link flow will work. But I have not received such a option for First install from Play Store and it shows Open
option which breaks the Dynamic Link and opens the app from start.
The code for generating Dynamic Link
is
String e="https://myappinvite.page.link/?link=https://myappinvite.page.link/?referid=10&apn=com.learnandro&amv=16&st=Please Install the App&si="+some Image Url+"&afl=https://play.google.com/store/apps/details?id=app Package name";
Task<ShortDynamicLink> shortLinkTask = FirebaseDynamicLinks.getInstance()
.createDynamicLink()
.setLongLink(Uri.parse(e))
.buildShortDynamicLink()
.addOnCompleteListener(new OnCompleteListener<ShortDynamicLink>() {
@Override
public void onComplete(@NonNull Task<ShortDynamicLink> task) {
Uri get=task.getResult().getShortLink();
Intent sh=new Intent(Intent.ACTION_SEND);
sh.setType("text/plain");
sh.putExtra(Intent.EXTRA_TEXT,"Vi ew the Amazing Event "+get);
startActivity(Intent.createChooser(sh,"View"));
}
});
The Manifest
file looks like this
<activity android:name=".login.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER"/>
<data
android:host="myappinvite.page.link"
android:scheme="https" />
</intent-filter>
</activity>
This is code for Receiving Dynamic Link if found inside onCreate
of Activity
FirebaseDynamicLinks.getInstance().getDynamicLink(getIntent())
.addOnSuccessListener(new OnSuccessListener<PendingDynamicLinkData>() {
@Override
public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
if (pendingDynamicLinkData !=null) {
Uri getDynamicLink=pendingDynamicLinkData.getLink();
String id=getDynamicLink.getQueryParameter("referid");
}
}
});
What actually is missing for not getting the whole experience of Dynamic Link ?