Deep links help us provide a seamless experience between the Sunbird portal and the mobile application. Assuming the application is installed, when a user taps a link from an email client or WhatsApp, we want the Android device to route the request directly to the Sunbird app application instead of the web experience.
Deep link support is broken in android 12(Snow Cone / SDK 31-32) devices due to some behavioral changes to apps targeting android 12
To support this Google has provided the following steps
Step - 1
Update the intent filters in AndroidManifest.xml with android:autoVerify="true"
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:exported="true" android:label="@string/activity_name" android:launchMode="singleInstance" android:name="MainActivity" android:screenOrientation="portrait" android:theme="@style/Theme.AppCompat.NoActionBar" android:windowSoftInputMode="adjustResize"> <intent-filter android:autoVerify="true" tools:targetApi="m"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:host="@string/deeplink_base_url" android:pathPrefix="/public" android:scheme="https" /> </intent-filter> </activity> |
Step - 2
Option - 1
Create an assetlinks.json file and add the following info to that file
[{ "relation": ["delegate_permission/common.handle_all_urls"], "target": { "namespace": "android_app", "package_name": "<Your App’s package name>", "sha256_cert_fingerprints": ["<Your App’s SHA256 finger print>"] } }] |
Option - 2
Use Android Studio’s App Link Assistant to generate the assetlinks.json file
Step - 3
Deploy the assetlinks.json
Upload the assetlinks.json file to the public object store (butcket). In case of Azure, it is storage account. e.g. https://sunbirdstagingpublic.blob.core.windows.net/public/Mobile-deeplink/assetlinks.json
Update the environment variable mobile_deeplink_url
with the full bucket url of the assetlinks.json file in the private repo ansible/inventory/{env}/Core/common.yaml
Deploy Nginx service by triggering Kubernetes/nginx-public-ingress
jenkins job to add/update proxy end point for android deeplink
You will be able to access the asset link via instance domain name e.g https://staging.sunbirded.org/.well-known/assetlinks.json
Step - 4
Verify the asset link using DigitalAssetLink API like following
Step - 5
Verify the changes in android app using the deeplinks