FirebaseDynamicLinks

abstract class FirebaseDynamicLinks


Provides access to dynamic links that are received by an app at launch.

When a dynamic link is clicked, the app is launched, or if the app is not yet installed, the user is directed to the Play Store to install and launch the app. In both cases the dynamic link made available to the app using getDynamicLink. An android.content.IntentFilter for the deeplink can also be used to launch the app directly into a targeted android.app.Activity or otherwise will start in the main launch Activity.

Dynamic link data returned from getDynamicLink can be accessed using the PendingDynamicLinkData class.

Android App Links can also be used to launch the app with dynamic links by registering to handle your Dynamic Links in your app. The guide for setting up your app to receive Firebase Dynamic Links as an App Link can be found on the Android Firebase Dynamic Links site.

Dynamic link data is available from the app launch intent. This data may include data for dynamic link extensions such as app invites.

Summary

Public constructors

Public functions

abstract DynamicLink.Builder

This function is deprecated.

Firebase Dynamic Links is deprecated and should not be used in new projects.

abstract Task<PendingDynamicLinkData!>
getDynamicLink(dynamicLinkUri: Uri)

This function is deprecated.

Firebase Dynamic Links is deprecated and should not be used in new projects.

abstract Task<PendingDynamicLinkData!>

This function is deprecated.

Firebase Dynamic Links is deprecated and should not be used in new projects.

synchronized java-static FirebaseDynamicLinks

This function is deprecated.

Firebase Dynamic Links is deprecated and should not be used in new projects.

synchronized java-static FirebaseDynamicLinks
getInstance(firebaseApp: FirebaseApp)

This function is deprecated.

Firebase Dynamic Links is deprecated and should not be used in new projects.

Extension functions

DynamicLink

Creates a DynamicLink object initialized using the init function.

DynamicLink

This function is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

Task<ShortDynamicLink>

Creates a ShortDynamicLink object initialized using the init function.

Task<ShortDynamicLink>

Creates a ShortDynamicLink object initialized using the init function.

Task<ShortDynamicLink>

This function is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

Task<ShortDynamicLink>

This function is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

Public constructors

FirebaseDynamicLinks

FirebaseDynamicLinks()

Public functions

createDynamicLink

abstract fun createDynamicLink(): DynamicLink.Builder

Create a long or short Dynamic Link.

Returns
DynamicLink.Builder

Builder to create the Dynamic Link.

getDynamicLink

abstract fun getDynamicLink(dynamicLinkUri: Uri): Task<PendingDynamicLinkData!>

Determine if the app has a pending dynamic link and provide access to the dynamic link parameters. A pending dynamic link may have been previously captured when a user clicked on a dynamic link, or may be present in the dynamicLinkUri parameter. If both are present, the previously captured dynamic link will take precedence. The captured data will be removed after first access.

This method provides the same functionality as getDynamicLink except the Uri is provided in place of the Intent.

Parameters
dynamicLinkUri: Uri

- A uri that may be a dynamic link.

Returns
Task<PendingDynamicLinkData!>

Task where isSuccessful is true when processing is completed successfully and either a dynamic link is returned, or null if a dynamic link is not previously captured or is in the Uri.

isSuccessful will only be false when a processing error occurs.

getDynamicLink

abstract fun getDynamicLink(intent: Intent?): Task<PendingDynamicLinkData!>

Determine if the app has a pending dynamic link and provide access to the dynamic link parameters. A pending dynamic link may have been previously captured when a user clicked on a dynamic link, or may be present in the intent.

When a dynamic link is clicked by the user, in most cases it is captured when clicked and stored until accessed by getDynamicLink and returned as the of the Task. If the dynamic link was not captured, as is the case when App Links launches the app, then the dynamic link is provided in the getData. The intent data is then processed to retrieve the dynamic link data. If the dynamic links is both captured and is present in the intent, then the captured data will take precedence. The captured data will be removed after first access.

The intent parameter should be the intent that launched the application, or can be null if the intent does not include the dynamic link. A non-null intent is necessary only when the app is launched directly using the dynamic link, such as when using App Links. The app must configure an android.content.IntentFilter to override the default capture processing when the link is clicked.

In the callback the PendingDynamicLinkData is returned in addOnSuccessListener or addOnCompleteListener which returns the most recently clicked dynamic link, or null if a dynamic link was not pending as captured data or in the intent.

If processing could not be completed due to an error, then OnFailureListener will be called. Notice that in the case a pending dynamic link is not present, then isSuccessful will be true and the returned PendingDynamicLinkData will be null as this is normal processing and not an error condition.

If a dynamic link, the call will also send FirebaseAnalytics dynamic link event.

getInstance

synchronized java-static fun getInstance(): FirebaseDynamicLinks

Returns an instance of FirebaseDynamicLinks.

The default FirebaseApp instance must have been initialized before this function is called. See FirebaseApp.

getInstance

synchronized java-static fun getInstance(firebaseApp: FirebaseApp): FirebaseDynamicLinks

Returns an instance of FirebaseDynamicLinks for the provided firebaseApp.

Extension functions

dynamicLink

fun FirebaseDynamicLinks.dynamicLink(init: DynamicLink.Builder.() -> Unit): DynamicLink

Creates a DynamicLink object initialized using the init function.

dynamicLink

fun FirebaseDynamicLinks.dynamicLink(init: DynamicLink.Builder.() -> Unit): DynamicLink

Creates a DynamicLink object initialized using the init function.

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-dynamic-links-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

shortLinkAsync

fun FirebaseDynamicLinks.shortLinkAsync(init: DynamicLink.Builder.() -> Unit): Task<ShortDynamicLink>

Creates a ShortDynamicLink object initialized using the init function.

shortLinkAsync

fun FirebaseDynamicLinks.shortLinkAsync(suffix: Int, init: DynamicLink.Builder.() -> Unit): Task<ShortDynamicLink>

Creates a ShortDynamicLink object initialized using the init function.

shortLinkAsync

fun FirebaseDynamicLinks.shortLinkAsync(init: DynamicLink.Builder.() -> Unit): Task<ShortDynamicLink>

Creates a ShortDynamicLink object initialized using the init function.

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-dynamic-links-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

shortLinkAsync

fun FirebaseDynamicLinks.shortLinkAsync(suffix: Int, init: DynamicLink.Builder.() -> Unit): Task<ShortDynamicLink>

Creates a ShortDynamicLink object initialized using the init function.

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-dynamic-links-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.