In today’s mobile-centric world, having a seamless user experience across different platforms and channels is crucial. Dynamic linking, also known as deep linking, is a powerful technique that allows you to create a seamless transition between your app and other apps or websites. It enables you to send users directly to specific content or activities within your app, providing a more engaging and contextual experience.
Dynamic linking is the process of creating a link that launches a specific part of your app, rather than just opening the app’s main screen. This is particularly useful when you want to direct users to a specific product page, a specific piece of content, or a specific feature within your app.
For Android, you can use Firebase Dynamic Links or App Links from the Android Developer Documentation. Both technologies allow you to create deep links that can launch specific content or activities within your app.
App Links is a feature provided by the Android platform that allows you to associate specific web URLs with specific content or activities within your app. Here’s a high-level overview of the steps involved:
First, define the intent filters in your Android manifest file (android/app/src/main/AndroidManifest.xml). These filters specify which URLs your app can handle.
<application>
<activity android:name=".MainActivity"
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="myownpersonaldomain.com" />
</intent-filter>
</activity>
</application>
Create a assetlinks.json file and host it on your website at https://www.example.com/.well-known/assetlinks.json. Here is sample file format.
{
"applinks": {
"details": [
{
"appIDs": [ "ABCDE12345.com.example.app", "ABCDE12345.com.example.app2" ],
"components": [
{
"#": "no_universal_links",
"exclude": true,
"comment": "Matches any URL with a fragment that equals no_universal_links and instructs the system not to open it as a universal link."
},
{
"/": "/buy/*",
"comment": "Matches any URL with a path that starts with /buy/."
},
{
"/": "/help/website/*",
"exclude": true,
"comment": "Matches any URL with a path that starts with /help/website/ and instructs the system not to open it as a universal link."
},
{
"/": "/help/*",
"?": { "articleNumber": "????" },
"comment": "Matches any URL with a path that starts with /help/ and that has a query item with name 'articleNumber' and a value of exactly four characters."
}
]
}
]
},
"webcredentials": {
"apps": [ "ABCDE12345.com.example.app" ]
},
"appclips": {
"apps": ["ABCDE12345.com.example.MyApp.Clip"]
}
}
Step3. Test Your Implementation:
Ensure that your links open your app correctly and that users without the app are redirected to your website seamlessly.
Universal Links is a feature provided by Apple that allows you to associate specific web URLs with specific content or activities within your app. Here’s a high-level overview of the steps involved:
Steps to Implement Universal Links
1. Adjust iOS Build Settings
Launch Xcode
Open Xcode.
Open the ios/AppName.xcworkspace file inside your project’s ios folder.
Add the <AppName>DeepLinkingEnabled Key Value Pair
In the Xcode Navigator, expand AppName and click Info.
In the Editor, Control-click and select Raw Keys and Values from the context menu.
Control-click again and select Add Row.
Set the new key properties as follows:
Key: <AppName>DeepLinkingEnabled
Type: Boolean
Value: YES
2. Add Associated Domains
Launch Xcode and Configure Associated Domains
Open Xcode if necessary.
Click the top-level Runner.
In the Editor, select the Runner target.
Click Signing & Capabilities.
Click + Capability under Signing & Capabilities and select Associated Domains.
In the Associated Domains section, click + and enter applinks:<web domain>, replacing <web domain> with your own domain name.
3. Associate Your App with Your Web Domain
You need to host an apple-app-site-association file in your web domain. This file tells the mobile browser which iOS application to open instead of the browser.
Locate Components of the App ID
Apple formats the app ID as <team id>.<bundle id>.
Locate the bundle ID in the Xcode project.
Locate the team ID in the developer account.
For example, with a team ID of S8QB4VV633 and a bundle ID of com.example.deeplinkCookbook, the app ID would be S8QB4VV633.com.example.deeplinkCookbook.
Create and Host apple-app-site-association JSON File
Create a JSON file with the following structure, adjusting the app ID as necessary:
{
"applinks": {
"apps": [],
"details": [
{
"appIDs": [
"S8QB4VV633.com.example.deeplinkCookbook"
],
"paths": [
"*"
],
"components": [
{
"/": "/*"
}
]
}
]
},
"webcredentials": {
"apps": [
"S8QB4VV633.com.example.deeplinkCookbook"
]
}
}
Host the file at the following URL structure: <webdomain>/.well-known/apple-app-site-association.
Ensure that your browser can access this file.
4. Test the Universal Link
Test a universal link using a physical iOS device or the Simulator. Note that it might take up to 24 hours for Apple’s Content Delivery Network (CDN) to request the apple-app-site-association (AASA) file from your web domain. To bypass Apple’s CDN, use the developer keyword like this
applinks:developer.example.com
Testing on Physical iOS Device
Launch the Notes app.
Type the URL in the Notes app.
Click the resulting link.
For iOS, you can use Universal Links or Branch.io. Both technologies allow you to create deep links that can launch specific content or activities within your app.
When implementing dynamic linking, it’s important to follow best practices to ensure a seamless user experience:
References
Android documentation to configure App Links in your Android project.
Universal links for developers.