0

I have the following intent filter for my activity (I am trying to test redirecting Android's default browser to my app):

<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.iana.org"/>

 </intent-filter>

When I browse Android' default browser to www.example.com, it has a link to http://www.iana.org/domains/example, but clicking that doesn't take the user to my activity.

What is missing in my intent filter ?

I am testing on Android 4.4 using Genymotion VM with Android Studio.

Jake
  • 16,329
  • 50
  • 126
  • 202
  • possible duplicate of [Handle a link in the Android browser/webview to start directly an application](http://stackoverflow.com/questions/7570253/handle-a-link-in-the-android-browser-webview-to-start-directly-an-application) – Parag Chauhan Jul 13 '14 at 08:09

1 Answers1

1

Try changing it to

<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="https" 
        android:host="www.iana.org/domains/reserved" />
      <data
        android:scheme="http"
        android:host="www.iana.org/domains/reserved"/>
</intent-filter>
CodeWarrior
  • 5,026
  • 6
  • 30
  • 46
  • 1
    Shouldn't both `android:host` and `android:path` be used here? – Halvor Holsten Strand Jun 28 '14 at 15:40
  • @Jake I've changed the code. When i clicked on your site it doesn't route to **http://www.iana.org/domains/example** but routes to **http://www.iana.org/domains/reserved** – CodeWarrior Jun 28 '14 at 15:48
  • @AndroidWarrior I tried it, it doesn't work. Can you please test it. I think the path should not make a difference. The host is correct : www.iana.org. – Jake Jun 28 '14 at 15:50
  • @AndroidWarrior I am testing on Android 4.4 using Genymotion VM with Android Studio. – Jake Jun 28 '14 at 16:05
  • @AndroidWarrior Never mind. I found the problem. My application tag was not configured correctly. Sorry to waste your time. – Jake Jun 28 '14 at 16:09
  • @Jake It's never a waste of time for helping anyone. :) – CodeWarrior Jun 28 '14 at 16:15