Set up App Links
Android App Links are a Beta feature. Functionality is subject to change as Trustly continues to make improvements. To enable this feature or request assistance, contact Trustly Support.
Android App Links allow seamless integration between your website and your Android application. By using standard HTTP or HTTPS links, you ensure that users are directed to specific content within your app without the need for browser redirects or system prompts.
Unlike custom URL schemes, App Links provide a reliable fallback strategy: if the application is not installed, the link functions as a standard web link and directs the user to your site. This guarantees the link resolves to the correct content, regardless of whether the app is installed.
Android recommends App Links as the primary method for deep linking due to their security and usability advantages over legacy URL schemes.
The following table compares the features and behavior of App Links versus custom URL schemes.
Define the digital asset links
To enable App Links, you must create a JSON file named assetlinks.json. This file defines the relationship between your website and your application. Host the file at the following location: https://yourdomain.com/.well-known/assetlinks.json.
Ensure your server meets the configuration requirements:
- The file must be served over HTTPS.
- The file must be served with the
Content-Typeheader set toapplication/json.
The following example demonstrates how to configure your package namespace and signing fingerprint.
Obtaining the SHA-256 Fingerprint
You can retrieve your signing key fingerprint using the keytool command line utility. Alternatively, in Android Studio, navigate to the Gradle tab and run the signingReport task.
Configuration reference
The following table describes the keys used to configure the assetlinks.json file.
Verify your configuration
Run the following command in your terminal to confirm your server is returning the correct Content-Type (it must be application/json):
The response headers should include Content-Type: application/json.
Configure the manifest
To handle the links, you must configure an intent filter in your AndroidManifest.xml file. This tells the Android system which URLs your app can handle.
Add the autoVerify="true" attribute to the intent filter. This instructs Android to verify the domain ownership by checking the assetlinks.json file upon installation. For example:
Handle incoming links
Android delivers the App Link to your Activity using an Intent. You must check for this Intent in both onCreate (for when the app starts) and onNewIntent (for when the app is already running).
The following example demonstrates how to extract the data from the Intent and route the user to the correct content.
Configure your deep link strategy (optional)
Android App Links function without a fallback. However, Trustly recommends having a default deep link strategy configured for your merchant account. This ensures your application has a consistent fallback behavior if a strategy isn’t explicitly provided within the establishData object in your code.
Any settings passed within the establishData object in your code override the default configurations stored in your Trustly account profile.
Because this setup requires internal configuration, you’ll need to contact your Customer Success Manager (CSM) or Trustly Support to enable this fallback for your account.
When you submit your request, you must provide the following information:
- Deep link strategy: Specify
universal-link. Trustly uses this unified backend term for both iOS Universal Links and Android App Links. - Universal Link: Provide your fully qualified domain (for example,
https://yourdomain.com/).