2

I'm trying to check how App Links work on android.

Here is what I have done so far -

  1. Set up a local server with MAMP, apache points to port 80.
  2. Created .well-known in the htdocs & also put the assetlinks.json in the created dir.
  3. I am able to access it using - http://192.168.0.78/.well-known/assetlinks.json

where 192.168.0.78 is my lan ip. I generated the SHA using the keytool command.

Here are the contents of the file assetlinks.json:

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "com.pbc.deeplinking_demo",
    "sha256_cert_fingerprints":
    ["D9:29:00:B9:30:F1:24:A0:E7:7A:58:74:43:C6:06:FF:F6:16:BB:42:F3:A2:16:10:5D:81:27:37:3A:E5:A6:14"]
  }
}]
  1. Set up an android app with the applicationId : com.pbc.deeplinking_demo

  2. Added the intent-filters with autoVerify=true to the activity

implementation below -

<activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>


            <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:host="192.168.0.78" />
            </intent-filter>


        </activity>

With this config, I continue to see the disambiguation dialog asking me to choose between the default browser and the target app.

Note: I am able to access the mamp page & also the assetlinks.json from Chrome on Android emulator.

Am I missing something here or is it not possible to test this in local environment?

Priyabrata
  • 1,202
  • 3
  • 19
  • 57

0 Answers0