I have created dynamic links using firebase console. I have a local app (app not yet on google play store) installed on my device.
This is the code in manifest file for handling dynamic links.
<activity android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- [START link_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"/>
<data
android:host="<code>.app.goo.gl/"
android:scheme="https"
android:pathPattern=".*" />
</intent-filter>
<!-- [END link_intent_filter] -->
</activity>
This is intent handler in activity
// [START build_api_client]
// Build GoogleApiClient with AppInvite API for receiving deep links
GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, this)
.addApi(AppInvite.API)
.build();
// [END build_api_client]
// [START get_deep_link]
// Check if this app was launched from a deep link. Setting autoLaunchDeepLink to true
// would automatically launch the deep link if one is found.
boolean autoLaunchDeepLink = false;
AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, autoLaunchDeepLink)
.setResultCallback(
new ResultCallback<AppInviteInvitationResult>() {
@Override
public void onResult(@NonNull AppInviteInvitationResult result) {
if (result.getStatus().isSuccess()) {
// Extract deep link from Intent
Intent intent = result.getInvitationIntent();
String deepLink = AppInviteReferral.getDeepLink(intent);
// Handle the deep link. For example, open the linked
// content, or apply promotional credit to the user's
// account.
// [START_EXCLUDE]
// Display deep link in the UI
//((TextView) findViewById(R.id.link_view_receive)).setText(deepLink);
Toast.makeText(getApplicationContext(), deepLink, Toast.LENGTH_LONG).show();
// [END_EXCLUDE]
} else {
Log.d(TAG, "getInvitation: no deep link found.");
}
}
});
// [END get_deep_link]
when i open dynamic link in mobile browser, it is not redirecting me to app. instead opening the link in mobile browser itself.
How to open the app when user try to hit dynamic link in mobile browser?
.app.goo.gl/VMUp. This is the same url created by firebase. please let me know if i m missing anything.
– user3559471 Jun 06 '16 at 10:13.app.goo.gl/?link=https://www.example.com/someresource&apn=com.example.android&amv=3&ad=1 depending on what parameters you gave (as explained here https://firebase.google.com/docs/dynamic-links/android#create-a-dynamic-link-programmatically)
– diidu Jun 06 '16 at 10:47.app.goo.gl/?link=google.com
– user3559471 Jun 06 '16 at 11:18.app.goo.gl/?link=google.com&apn= But that also doesn't work.
– user3559471 Jun 06 '16 at 11:27