Android Deeplink
Android Deep Linking
To implement deep linking, modify your app's manifest by adding an intent filter with specific elements and attribute values. Below is an example of how to set up an intent filter for deep linking:
This configuration allows both
example://gizmos
andhttp://www.example.com/gizmos
to resolve to the same activity in your app.
Note that the two intent filters only differ by the data
element. While it's possible to include multiple data
elements in the same filter, it's crucial to create separate filters when declaring unique URLs, such as a specific combination of scheme
and host
. This is important because multiple data
elements in the same intent filter are merged together to account for all variations of their combined attributes. For example, consider the following:
While it may seem that this supports only https://www.example.com
and app://open.my.app
, it actually covers those two as well as app://www.example.com
and https://open.my.app
.
After you've added intent filters with URIs for activity content to your app manifest, Android can route any Intent
with matching URIs to your app at runtime.
Once the deep link definitions are complete, if you import the following method into build.gradle
(app), users will be redirected to the deep link by the Netmera SDK when they click the notification. The Netmera SDK directs the user to the deep links defined in the manifest.
You can also obtain the deep link URI from the NMPushActionCallbacks
class.
For more detailed information on deep linking in Android, you can refer to the official Android documentation: Android Deep Linking
Universal Links
Configure the Project
Set android:autoVerify="true"
in one of the web URL intent filters in the app manifest that includes the android.intent.action.VIEW
intent action and android.intent.category.BROWSABLE
intent category.
Configure the website
Create an assetlinks.json
file with package_name
(the application ID declared in the app's build.gradle
file) and sha256_cert_fingerprints
(the SHA256 fingerprints of the app’s signing certificate).
Host the assetlinks.json
file. Publish the assetlinks.json
file on the domain. Ensure it is hosted on the website to indicate the association of Android apps with the website and to verify the app's URL intents.
Deeplink Callback
You can also retrieve the universal link URL from the NMPushActionCallbacks
class.
Custom Intent Handling
To create and manage your own intents, follow these steps:
Configure Deeplink in Push Action: In the panel or via REST API, set "deeplink" as the push action. Ensure that any custom parameters are included in the deeplink configuration.
Implement a Custom Callback in the Android SDK:
Within the SDK's initialization configuration, define your custom handler by assigning it to the
nmDeeplinkCallback
.This setup directs the SDK to bypass its default handling of the deeplink and instead forward the
pushObject
to your custom callback.
Last updated