8

I have been experimenting with the Intent Filters for the past few hours, and I am really confused as to why the Google tutorial code for Handling App Links via Intent Filters is not working on my physical Samsung S8 devices's default Samsung browser or Firefox installed on it however working from the Google Chrome app.

The code also works both in the default Android Studio Nexus 5's emulator default browser app as well as from Google Chrome.

Here is the relevant code I have in the AndroidManifest.xml of the bare-bones app I am trying to diagnose the problem with:

<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" />
    <data android:scheme="https" />
    <data android:host="www.android.com"  />
</intent-filter>

What I am doing to test:

I click on a link for https://www.android.com from a search results page on Google.

I expect to see a open with dialog with my test apps name however it does not show when I try this from anything but the the google chrome browser (and the Nexus 5 emulators default browser) it just automatically shows the webpage with no popup dialog.

N.B. I have tried also tried the following things so far to no avail:

  • Changing the first line to <intent-filter android:autoVerify="true">
  • Adding the line <data android:host="www.android.com/" /> in case the the problem has anything to do with the / at the end of URL.
  • Clearing the both browsers data/storage & generally resetting it.

Does anyone know why this is happening / how to fix this?

Sagar V
  • 12,158
  • 7
  • 41
  • 68
Sash Sinha
  • 18,743
  • 3
  • 23
  • 40
  • what happens when you click a link on that device? does the pop-up appear? if not, you have a default app already defined for that intent type, therefore the dialog will not appear ever until you clear that. – Fco P. Jun 21 '17 at 15:53
  • The popup appears from chrome though? And also firefox but not the Samsung browser. – Sash Sinha Jun 21 '17 at 19:19
  • For autoVerify to work you have to place the .well-known/assetlinks.json file to the domain's root. And I don't think you own android.com. Why don't you try with your own domain? Follow the tutorial. ***///*** And another point is maybe android.com is protected from potentially malicious apps trying to take over. Use your own domain. – Eugen Pechanec Jun 25 '17 at 09:32
  • Do you know if Samsung's latest default browser is known to have any issues regarding this? As pointed out in the first answer Firefox actually works with the above code (just its hard to tell)... Basically as an Android developer have you heard of any issues specifically with a recentish version of Samsung browser. – Sash Sinha Jun 25 '17 at 12:23
  • @EugenPechanec The people who will use my app are very very likely to be using Samsung devices and I presume many of whom will use the default Samsung Browser (which I also use). – Sash Sinha Jun 25 '17 at 12:28
  • 1
    The samsung browser is a light weight built in browser, in other words: a worthless browser that cannot handle anything like saving calendar events, linking to other apps etc. It's a shame that they force it on users as a default when it cannot handle te basic stuff users expect from browsers now a days... – JavaDevSweden Oct 26 '17 at 20:57
  • @ShashSinha, Did you get any solution for this? – Rakesh Feb 03 '21 at 13:05
  • @Rakesh I think the most recent answer might help. – Sash Sinha Feb 03 '21 at 13:45

3 Answers3

9

The browsers itself need to support and implment the browsability. The browsers have to find other activities supporting android.intent.category.BROWSABLE when opening a web-page.

Firefox implements a less invasive experience to the user. When an url is opened which has a deep link to an app, the url bar displays a page action with a little Android head. Clicking on this one will open the link with an Android activity other than a browser.

The behavior of the Android browser and Chrome you observed and made your expectation. So nothing to add to this.

I'm not sure if I can fully talk about the Samsung browser, because the versions I have on my devices might be somehow outdated; but I couldn't make it work with these at all.

The android:autoVerify attribute only makes the app the default on installation. android:host="www.android.com/" is just wrong, because / is the path and not part of the host.

tynn
  • 38,113
  • 8
  • 108
  • 143
5

You can fix this by go to Samsung Browser setting > Useful features > Open links in other appsenter image description here

This may be late for you but hope it will help others.

Quang Nhat
  • 135
  • 1
  • 8
  • Damn, I wonder in which version this was added. Do you know if the default is enabled in new Samsung phones? I don't have a Samsung or Android anymore to test but am curious since I am not sure how many end-users would enable it themselves otherwise. – Sash Sinha Jan 15 '21 at 08:57
  • 1
    this option is disabled by default, I checked on 2 Samsung devices – Quang Nhat Jan 15 '21 at 09:08
-2

Opening the app for certain links only

<intent-filter>
  <action android:name="android.intent.action.VIEW"></action>
  <category android:name="android.intent.category.DEFAULT"></category>
  <category android:name="android.intent.category.BROWSABLE"></category>
  <data android:scheme="spuul"></data>
</intent-filter>

With this, all URI’s like spuul://movies/123 will be openend by the app. The app is then able to handle this URI and launch the correct content. The link to Google Play like market://details?id=com.spuul.android.

Fallback to market if app is not installed

<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="http" android:host="android.app.spuul.com" android:pathPrefix=""></data>
</intent-filter>
Mahesh Lad
  • 1,997
  • 1
  • 9
  • 8