3

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.

app dialog picker

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

4
  • What do you mean with 'the in-app browser'? Commented May 19, 2020 at 6:48
  • Oh, sorry for the ambigous term. The term "in-app" I was referring to is the web browser that opens within an app when a link in the app is clicked. Say for example in facebook, when you click a website link from a page, it opens it's own browser and not the default browser in the device (e.g. Chrome). It is also different from a WebView. Hope it makes sense Commented May 19, 2020 at 7:19
  • Dont understand. when a link in the app is clicked. Where would that link be displayed? And where does that browser come from? What kind of browser? How did you add it to your app? Commented May 19, 2020 at 7:28
  • I found the in-app browser term. It's called Chrome Custom tabs developer.chrome.com/multidevice/android/customtabs . But still no luck in launching my app from it. Commented May 20, 2020 at 0:47

1 Answer 1

4

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> 
Sign up to request clarification or add additional context in comments.

1 Comment

This seems to be correct, but do you have any official documentation where this is stated?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.