I am trying to add deep linking to my app. I have added 2 intent filters to one of my activities, one filter for the "http" scheme, and another for my custom scheme (I'm using "example"). I have added one intent filter per scheme, based on the info in this SO (Deep-linking intent does not work), so that I can handle both example://test
and http://www.example.com/test
type of links.
Here is my XML:
<activity
android:name="com.myapp.myapp.SplashActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="Intent Filter label">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER" />
<!-- Accepts URIs that begin with "http://www.example.com/test2” -->
<data android:scheme="http"
android:host="www.example.com"
android:pathPrefix="/test2" />
</intent-filter>
<intent-filter android:label="Intent Filter label">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER" />
<!-- Accepts URIs that begin with "example://test2” -->
<data android:scheme="example"
android:host="test2" />
</intent-filter>
</activity>
They are loading correctly when I test in ADB:
adb shell am start -W -a android.intent.action.MAIN -d "example://test2" com.myapp.myapp
returns
Starting: Intent { act=android.intent.action.MAIN dat=example://test2 pkg=com.myapp.myapp } Status: ok Activity: com.myapp.myapp/com.app.myapp.SplashActivity ThisTime: 357 TotalTime: 357 Complete
However, I get absolutely nothing in a browser. When I try this in a browser:
"example://test2
" in FF I get "couldn't find an app to open this link
" and in Chrome and the Native Browser, it opens up new Google search for "example://test2
".
When I try the other style: "http://www.example.com/test2
" it just tries to navigate to that web page in all 3 browsers.
I am deploying the app to my phone from Android Studio. I have also tried by generating a debug APK, sending it to my phone, and installing. Same result for both. What am I doing wrong? I've followed the guide (https://developer.android.com/training/app-indexing/deep-linking.html) to the letter as far as I can tell. Does my app need to be in the store for the deep linking to work?