Search code examples
androidandroid-intentintentfilterurl-scheme

How to open Android app, after a click on website link?


I want to open Android app when url click from browser, for this I had implemented intent filter in manifest with uri scheme below-

<intent-filter>
  <data android:host="www.myweb.com" android:scheme="https"/>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

When user click www.myweb.com on browser or whatsapp or facebook then mobile browser is open instead of android app. Is there any thing I am doing wrong in above code? Any help on this.


Solution

  • Are you doing this?

    Go to Tools > App Links Assistant.

    • Follow the guidelines by creating URL mapping by clicking on the "+" button.
    • Select the activity and add the logic to handle intent.

    • Third, and the most important step is to have access to the website you are mentioning. You need to add Digital Asset Links file by generating it and adding it to the mentioned location.

    • You can test the app links now by visiting the website from your browser. You are ready to go.

    NOTE:

    • By following the procedure you can make sure the app supports deep linking, however it is completely upto the user who can control to enable or disable to open the website and redirect it directly to your app.

    • Make sure you have your app defaults URLs set to open the app with your app. Visit,

      App Info > Open by default > Open supported links > Open in this app.

    Documentation: