3

I have created a deep link but problem is it's opening a dialog as "Open with or use a different app"

I don't want to make user to decide to choose the dialog. I want to directly open my app. Here is the code.

<activity android:name=".DeepLinkingActivity">
    <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.google.com"
            android:pathPrefix="/help"
            android:scheme="https" />
    </intent-filter>
</activity>

class DeepLinkingActivity : AppCompatActivity() {
    var datas: Uri? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_deep_link)
    }

    override fun onResume() {
        super.onResume()
        var intent = intent
        datas = intent.data
        Log.v("TestingsDatas", "" + datas)

    }
}
Natig Babayev
  • 3,128
  • 15
  • 23
Ramji V
  • 121
  • 1
  • 5

1 Answers1

3

If you don't want to see that dialog. You have to verify that the host you are trying to navigate is related with your app. In this sample the host is "www.google.com". At first this url must belong to you. Lets assume that you own "www.example.com" You will put a Digital Asset Links JSON file to the path below:

https://www.example.com/.well-known/assetlinks.json

And its content should be like below including your package name and your keystore (used in Google Play) sha256 fingerprint:

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "com.example",
    "sha256_cert_fingerprints":
    ["14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"]
  }
}]

Than you won't see that dialog. For more details: https://developer.android.com/training/app-links/verify-site-associations.html

Faruk Toptas
  • 1,257
  • 14
  • 21