Reputation: 81
I'm trying to launch my android application through a browser link.
When I open the link through the chrome browser, it successfully shows the App Dialog Picker which shows the app available for the scheme like this.
But when the link is opened through the Chrome Custom tab, it just redirects to the site without showing the App Dialog Picker.
I need it to launch the app or show the dialog picker when the link is opened from another app (like gmail) which opens the in-app browser and not just in the chrome browser.
here is the current intent-filter I have.
<intent-filter>
<data
android:scheme="http"
android:host="www.myapp.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
If anyone could point out would be a great help. Thanks
Upvotes: 3
Views: 3970
Reputation: 81
So if ever anyone encounters the same problem, here's what I did. To launch your app with Chrome Custom Tabs browser, you need to make your scheme a non web-link format and make it into a custom scheme (example below). Because apparently, Chrome Custom tabs considers web link schemes as an ordinary link therefore launching it in the browser.
so from
<intent-filter>
<data
android:scheme="http"
android:host="www.myapp.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
change the scheme to a custom one, that way, your app's scheme will be the only one that gets handled by the browser. This is an example link with the scheme given below ~ myapp://myapp.app (note that this link is not clickable in android apps, but you can place it in the href of the html anchor tag of your website).
<intent-filter>
<data
android:scheme="myapp"
android:host="myapp.app" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
Upvotes: 4