Search code examples
androidurlandroid-sharing

Launch my app by clicking URL from WhatsApp


I have an app for daily news, knowledge sharing, etc. In this, by clicking the share button we can share a particular news item with others in WhatsApp/Facebook/Twitter etc. If the other person clicks this URL, different web browsers are displayed to open the post. But I want my app to be listed in this list if the user has installed my app otherwise open in a web browser. How to do this in android?


Solution

  • Just add android:launchMode="singleTask" in AndroidManifest.xml so it will always open your app separately.

     <!-- Deep & App Link -->
     <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" android:host="google.in" />
         <data android:scheme="https" android:host="google.in" />
     </intent-filter>