Search code examples
androidgoogle-chromewebviewsfsafariviewcontroller

Android equivalent of iOS' SFSafariViewController


On iOS, there are 3 ways to display web content (as I was told by a iOS dev):

  1. a UIWebView displayed inside a UIControllerView if I am correct
  2. a SFSafariViewController as a UIControllerView
  3. Safari, the app itself

on Android, as far as I am concerned, there are only two ways :

  1. a WebView (inside a Fragment or Activity layout)
  2. the user default browser app, if any, (usually Chrome, but you know anything that can handle the Action.View Intent).

Anyway, the advantage of the SFSafariViewController is that you have a full-fledged web browser in your app without leaving your app with a constant UX across the entire OS.

Recently, I came across apps such as Reddit or the French railway app (OuiSNCF) where web content are displayed in a manner that looks definitely like the SFSafariViewController on iOS :

  • it is displayed in separate on top your current Activity
  • it shows the URL and if it is secured
  • and the three dots menu icon says, at the bottom of the dialog upon touch, "Provided by Chrome" (if I am correct as my phone is in French).

But looking on the internet and here on SO, I can only find ways to launch Chrome itself via Intents. Looking for ChromeView I stumbled on some projects, nothing official.

So here I am asking this question: is this official in any way ? Is there really a sort of ChromeWebView similar to that of the SFSafariViewController on iOS ? If yes, how can it be implemented ?

Thanks for the answers !


Solution

  • It seems there is indeed an official way : Chrome Custom Tabs as detailed here: https://developer.chrome.com/multidevice/android/customtabs.