Receive Firebase Dynamic Links on Android Stay organized with collections Save and categorize content based on your preferences.
To receive theFirebase Dynamic Links thatyou created, you must include theDynamic Links SDK in your app and call theFirebaseDynamicLinks.getDynamicLink() method when your app loads toget the data passed in theDynamic Link.
Set up Firebase and theDynamic Links SDK
If you haven't already,add Firebase to your Android project.
When you register your app, specify your SHA-1 signing key. If you use App Links, also specify your SHA-256 key.
In yourmodule (app-level) Gradle file(usually
<project>/<app-module>/build.gradle.ktsor<project>/<app-module>/build.gradle),add the dependency for theDynamic Links library for Android. We recommend using theFirebase Android BoMto control library versioning.For an optimal experience withDynamic Links, we recommendenablingGoogle Analyticsin your Firebase project and adding the Firebase SDK for Google Analytics to your app.
dependencies{// Import theBoM for the Firebase platformimplementation(platform("com.google.firebase:firebase-bom:34.9.0"))// Add the dependencies for theDynamic Links andAnalytics libraries// When using theBoM, you don't specify versions in Firebase library dependenciesimplementation'com.google.firebase:firebase-dynamic-links'implementation'com.google.firebase:firebase-analytics'}
By using theFirebase Android BoM, your app will always use compatible versions of Firebase Android libraries.
(Alternative) Add Firebase library dependencies without using theBoM
If you choose not to use theFirebase BoM, you must specify each Firebase library version in its dependency line.
Note that if you usemultiple Firebase libraries in your app, we strongly recommend using theBoM to manage library versions, which ensures that all versions are compatible.
dependencies{// Add the dependencies for theDynamic Links andAnalytics libraries// When NOT using theBoM, you must specify versions in Firebase library dependenciesimplementation'com.google.firebase:firebase-dynamic-links:22.1.0'implementation'com.google.firebase:firebase-analytics:23.0.0'}
- In theFirebase console, open theDynamic Links section. Accept the terms of service if you are prompted to do so.
Add an intent filter for deep links
As withplain deep links, you must add a new intent filter to the activity that handlesdeep links for your app. The intent filter should catch deep links of your domain, since theDynamic Link will redirect to your domain if your app is installed. This is required for your app toreceive theDynamic Link data after it is installed/updated from the Play Store and one taps onContinue button. InAndroidManifest.xml:
<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="example.com" android:scheme="https"/></intent-filter>
When users open aDynamic Link with a deep link to the scheme and host you specify, your app willstart the activity with this intent filter to handle the link.
Handle deep links
To receive the deep link, call thegetDynamicLink() method:
Kotlin
Firebase.dynamicLinks.getDynamicLink(intent).addOnSuccessListener(this){pendingDynamicLinkData:PendingDynamicLinkData?->// Get deep link from result (may be null if no link is found)vardeepLink:Uri?=nullif(pendingDynamicLinkData!=null){deepLink=pendingDynamicLinkData.link}// Handle the deep link. For example, open the linked// content, or apply promotional credit to the user's// account.// ...}.addOnFailureListener(this){e->Log.w(TAG,"getDynamicLink:onFailure",e)}
Java
FirebaseDynamicLinks.getInstance().getDynamicLink(getIntent()).addOnSuccessListener(this,newOnSuccessListener<PendingDynamicLinkData>(){@OverridepublicvoidonSuccess(PendingDynamicLinkDatapendingDynamicLinkData){// Get deep link from result (may be null if no link is found)UrideepLink=null;if(pendingDynamicLinkData!=null){deepLink=pendingDynamicLinkData.getLink();}// Handle the deep link. For example, open the linked// content, or apply promotional credit to the user's// account.// ...// ...}}).addOnFailureListener(this,newOnFailureListener(){@OverridepublicvoidonFailure(@NonNullExceptione){Log.w(TAG,"getDynamicLink:onFailure",e);}});
You must callgetDynamicLink() in every activity that might belaunched by the link, even though the link might be available from the intentusinggetIntent().getData(). CallinggetDynamicLink()retrieves the link and clears that data so it is only processed once by yourapp.
You normally callgetDynamicLink() in the main activity as wellas any activities launched by intent filters that match the link.
Record analytics
The following events can be automatically tracked inGoogle Analytics and shown in theFirebase console.
dynamic_link_app_opendynamic_link_first_opendynamic_link_app_update
In order to register these events, you need to configureGoogle Analytics before you retrieve the deep link. Check the following conditions are met:
- Call
FirebaseDynamicLinks.getDynamicLink()in your app entry points: - Launcher activities. e.g.:
action="android.intent.action.MAIN",category="android.intent.category.LAUNCHER". - Activity entry points. e.g.:
onStart(),onCreate(). - Deep link activities.
- Set up and useGoogle Analytics:
- Include theGoogle Analytics dependency. This is usually automatically added by the
google-servicesGradle plugin. - Include the
google-services.jsonconfig file in your app. - Call
FirebaseAnalytics.getInstance()before callingFirebaseDynamicLinks.getDynamicLink().
HandlingDynamic Links using App Links
On Android 6.0 (API level 23) and higher, you can set up your app to handleDynamic Links directly when your app is already installed by usingAndroid App Links.
Ensure that you have added the SHA256 certificate fingerprint for your app into your project in theFirebase console.Dynamic Links will handle setting up the App Links website association for yourDynamic Links domain.
Add an auto-verified intent filter to the Activity that will handle theDynamic Link, setting the host to your project'sDynamic Links domain asfound in theFirebase console. In theAndroidManifest.xml:
<intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:host="example.com/link" android:scheme="http"/> <data android:host="example.com/link" android:scheme="https"/></intent-filter>
Note that theandroid:host must be set to yourDynamic Links domain, and not the domain of your deep link.
AllautoVerify intent filters in your manifest must be registered in order for App Links to engage. Firebase handles this automatically for yourDynamic Links domains, but you can check this by opening theassetlinks.json file hosted on yourDynamic Links domain:
https://YOUR_DOMAIN/.well-known/assetlinks.json
Dynamic Links will now be sent directly to your app. You will be able to get the deep link and otherDynamic Link data by callinggetDynamicLink() in the Activity you added the App Links intent filter to (as described inHandle deep links).
Note: Since invoking through App Links takes the user directly to the app, a Dynamic Link cannot honor the required minimum version. So once the app is opened, you need to compare the Dynamic Link's minimum version ( getminimumappversion) against PackageInfo.versionCode and redirect the user to upgrade the app if required using getUpdateAppIntent.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-18 UTC.