preface

First, let’s talk about the effect to be achieved: in the process of product operation, there are often some messages or activities to inform users, and it is necessary to wake up sleepy users. After comprehensive consideration, we decide to send an activity link through SMS, and click this link to directly jump to our APP

The user receives the message – “click the message -” to open the APP directly if the APP has been downloaded, and open a web page address to guide the user to download if the APP has not been downloaded

DEEP-LINK

In Android, clicking on a link sends an implicit Intent action = VIEW. Just add an Intent filter in our APP to satisfy this rule

Intent filters
<intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data android:host="www.myapp.com" android:scheme="http" />
    <data android:host="www.myapp.com" android:scheme="https" />
</intent-filter>
Copy the code
1. Test it out
  • Click on the address (www.myapp.com) (http://www.myapp….
  • Can also through the command line tools adb shell am start – W – a android intent. Action. The VIEW – d “www.myapp.com”
  • So now we’ve just clicked on a link to jump to our App
2. Problems encountered:

Every time I click it, there will always be a popup box for me to confirm twice (generally, it is to select browser, as long as it is browser, it will correspond to HTTP or shceme with the beginning of HTTP. If your APP has multiple browsers, it will appear in the options of this popup box).

APP LINK

App Link is a new feature (Android 6.0), when users click a link, they can directly jump to our app, without the need for a second confirmation through popup

Android: Verify=”true” Intent Intent =” True “Android: Verify=”true” Intent Intent =” True”
<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:host="www.myapp.com" android:scheme="http" />
    <data android:host="www.myapp.com" android:scheme="https" />
</intent-filter>
Copy the code
Add meta-data to AndroidManifest
<meta-data android:name="asset_statements" android:resource="@string/asset_statements" />
Copy the code
3. Add values to strings.xml
<string name="asset_statements" translatable="false">
    [{
    "include": "https://www.myapp.com/.well-known/assetlinks.json"
    }]
</string>
Copy the code

or

<string name="asset_statements">
  [{
    \"relation\": [\"delegate_permission/common.share_location\"],
    \"target\": {
      \"namespace\": \"web\",
      \"site\": \"https://example.com\"
    }
  }]
</string>
Copy the code
4, Put an encrypted file on host

Open the App Links Assistant

A. Associate B. Associate C. Associate D. Associate

Note that the site domain must be HTTPS.

Preview verifies the contents of the file and drops the file onto the server.

Applink is now available