FirebaseDynamicLinks

public 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 methods

abstract @NonNull DynamicLink.Builder

This method is deprecated.

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

abstract @NonNull Task<PendingDynamicLinkData>
getDynamicLink(@NonNull Uri dynamicLinkUri)

This method is deprecated.

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

abstract @NonNull Task<PendingDynamicLinkData>

This method is deprecated.

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

synchronized static @NonNull FirebaseDynamicLinks

This method is deprecated.

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

synchronized static @NonNull FirebaseDynamicLinks

This method is deprecated.

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

Extension functions

final @NonNull DynamicLink

Creates a DynamicLink object initialized using the init function.

final @NonNull DynamicLink

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

final @NonNull Task<@NonNull ShortDynamicLink>

Creates a ShortDynamicLink object initialized using the init function.

final @NonNull Task<@NonNull ShortDynamicLink>

Creates a ShortDynamicLink object initialized using the init function.

final @NonNull Task<@NonNull ShortDynamicLink>

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

final @NonNull Task<@NonNull ShortDynamicLink>

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

Public constructors

FirebaseDynamicLinks

public FirebaseDynamicLinks()

Public methods

createDynamicLink

public abstract @NonNull DynamicLink.Builder createDynamicLink()

Create a long or short Dynamic Link.

Returns
@NonNull DynamicLink.Builder

Builder to create the Dynamic Link.

getDynamicLink

public abstract @NonNull Task<PendingDynamicLinkDatagetDynamicLink(@NonNull Uri dynamicLinkUri)

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
@NonNull Uri dynamicLinkUri

- A uri that may be a dynamic link.

Returns
@NonNull 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

public abstract @NonNull Task<PendingDynamicLinkDatagetDynamicLink(@Nullable Intent intent)

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 public static @NonNull FirebaseDynamicLinks getInstance()

Returns an instance of FirebaseDynamicLinks.

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

getInstance

synchronized public static @NonNull FirebaseDynamicLinks getInstance(@NonNull FirebaseApp firebaseApp)

Returns an instance of FirebaseDynamicLinks for the provided firebaseApp.

Extension functions

FirebaseDynamicLinksKt.dynamicLink

public final @NonNull DynamicLink FirebaseDynamicLinksKt.dynamicLink(
    @NonNull FirebaseDynamicLinks receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull DynamicLink.BuilderUnit> init
)

Creates a DynamicLink object initialized using the init function.

FirebaseDynamicLinksKt.dynamicLink

public final @NonNull DynamicLink FirebaseDynamicLinksKt.dynamicLink(
    @NonNull FirebaseDynamicLinks receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull DynamicLink.BuilderUnit> init
)

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.

FirebaseDynamicLinksKt.shortLinkAsync

public final @NonNull Task<@NonNull ShortDynamicLinkFirebaseDynamicLinksKt.shortLinkAsync(
    @NonNull FirebaseDynamicLinks receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull DynamicLink.BuilderUnit> init
)

Creates a ShortDynamicLink object initialized using the init function.

FirebaseDynamicLinksKt.shortLinkAsync

public final @NonNull Task<@NonNull ShortDynamicLinkFirebaseDynamicLinksKt.shortLinkAsync(
    @NonNull FirebaseDynamicLinks receiver,
    int suffix,
    @ExtensionFunctionType @NonNull Function1<@NonNull DynamicLink.BuilderUnit> init
)

Creates a ShortDynamicLink object initialized using the init function.

FirebaseDynamicLinksKt.shortLinkAsync

public final @NonNull Task<@NonNull ShortDynamicLinkFirebaseDynamicLinksKt.shortLinkAsync(
    @NonNull FirebaseDynamicLinks receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull DynamicLink.BuilderUnit> init
)

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.

FirebaseDynamicLinksKt.shortLinkAsync

public final @NonNull Task<@NonNull ShortDynamicLinkFirebaseDynamicLinksKt.shortLinkAsync(
    @NonNull FirebaseDynamicLinks receiver,
    int suffix,
    @ExtensionFunctionType @NonNull Function1<@NonNull DynamicLink.BuilderUnit> init
)

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.