0

My objective is to open my android application when user clicks link e.g I have shared specific item link (http://example.com/api_shirts.php?utmsource=shirt98) then if user have already installed my application then open it else where open it on browser.

I have searched a lot and get this but it's not working for me

       <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:scheme="http"
                android:host="www.example.com" />
            <data android:scheme="https"
                android:host="www.example.com"/>
        </intent-filter>
CodeWithVikas
  • 1,105
  • 9
  • 33
Abdulkadir Ugas
  • 415
  • 5
  • 13
  • 2
    This is called [Deep linking](https://developer.android.com/training/app-links/deep-linking). There's a [similar question](https://stackoverflow.com/questions/38339032/how-to-open-a-deep-linking-uri-in-android) about this – Arthur Attout Nov 21 '19 at 12:42
  • You can implement deep linking by branch io, check this https://docs.branch.io/apps/android/ – swati vishnoi Nov 21 '19 at 12:49
  • @ArthurAttout thanks but it shows as prompt how can I make it default – Abdulkadir Ugas Nov 21 '19 at 13:38
  • Does this answer your question? [How to open app from a link without asking user to decide between browser or app, just open my app immediately](https://stackoverflow.com/questions/34359781/how-to-open-app-from-a-link-without-asking-user-to-decide-between-browser-or-app) – Arthur Attout Nov 21 '19 at 14:15

1 Answers1

0

I'm not sure if you may need to set a pathPrefix on this case. Also, the OS may open other prefered app that the user has set up as default app for that schema.

If I remember correcly you have to associate your app with your website so the OS can open the app directly bypassing the user's choice:

https://developer.android.com/studio/write/app-link-indexing.html#associatesite

Also, check https://developer.android.com/training/app-links/verify-site-associations.html to read about "deep links" vs "app links". You need app links for what you are trying to do.

  • thanks man, deep link is what I was looking for but I want to open automatically without any choice now I am getting "which one would you like to open my app or chrome" something like that – Abdulkadir Ugas Nov 21 '19 at 13:59