FirebaseDynamicLinks

public abstract class FirebaseDynamicLinks extends Object

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(Intent). An IntentFilter for the deeplink can also be used to launch the app directly into a targeted Activity or otherwise will start in the main launch Activity.

Dynamic link data returned from getDynamicLink(Intent) can be accessed using 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.

Public Constructor Summary

Public Method Summary

abstract DynamicLink.Builder
createDynamicLink()
Create a long or short Dynamic Link.
abstract Task<PendingDynamicLinkData>
getDynamicLink(Uri dynamicLinkUri)
Determine if the app has a pending dynamic link and provide access to the dynamic link parameters.
abstract Task<PendingDynamicLinkData>
getDynamicLink(Intent intent)
Determine if the app has a pending dynamic link and provide access to the dynamic link parameters.
synchronized static FirebaseDynamicLinks
getInstance()
Returns an instance of FirebaseDynamicLinks.

Inherited Method Summary

Public Constructors

public FirebaseDynamicLinks ()

Public Methods

public abstract DynamicLink.Builder createDynamicLink ()

Create a long or short Dynamic Link.

Returns
  • Builder to create the Dynamic Link.

public abstract Task<PendingDynamicLinkData> getDynamicLink (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(Intent) except the Uri is provided in place of the Intent.

Parameters
dynamicLinkUri - A uri that may be a dynamic link.
Returns
  • 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.

public abstract Task<PendingDynamicLinkData> getDynamicLink (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(Intent) and returned as the PendingDynamicLinkData of the Task. If the dynamic link was not captured, as is the case when App Links launches 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 IntentFilter to override the default capture processing when the link is clicked.

In the callback the PendingDynamicLinkData is returned in addOnSuccessListener(OnSuccessListener) or addOnCompleteListener(Activity, OnCompleteListener) 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.

public static synchronized FirebaseDynamicLinks getInstance ()

Returns an instance of FirebaseDynamicLinks.

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

Send feedback about...

Need help? Visit our support page.