Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebView vs Chrome Custom Tab

I am building an app where in a Detail Activity I have to show a web page. I was going to use WebView, but then I saw Chrome Custom Tab.

What do you guys think it's better to implement and why?

like image 659
Angelo Parente Avatar asked Mar 09 '17 08:03

Angelo Parente


2 Answers

If you just want to show a certain page then I would suggest you use chrome custom tabs. You can style the toolbar in a way it resembles your app style and they are intended for showing content without you having to worry much about anything else.

if you want to have full control over what the user is doing inside this website you have to use a webview. (you can prevent the user clicking links on the webview, you could intercept data the user inputs into controls on the website...) But this can also be a negative aspect since the user really has to trust you that you don't log his data or even fiddle with it.

summary: "The WebView is good solution if you are hosting your own content inside your app. If your app directs people to URLs outside your domain, we recommend that you use Chrome Custom Tabs"

-> If it isn't your website you probably should go with custom tabs.

https://developer.chrome.com/multidevice/android/customtabs#whentouse

like image 165
stamanuel Avatar answered Oct 21 '22 08:10

stamanuel


Webview : If you want your own content which has click listeners and data interception you need to go to webview. But It wont share the state with the browser.

Chrome Custom tab : If You are just redirecting to a url, i prefer chrome custom tab. But it has little cons too. We wont change its title text color where we can change the titlebar color. The text color will be chosen by the theme color only. And We can add actions, but we cant change the overflow menu icon or the entire actions displayed in the overflow action. Even though the limitation are not a big deal. I recommend chrome custom tab over webview.

like image 41
Rajalakshmi Arumugam Avatar answered Oct 21 '22 09:10

Rajalakshmi Arumugam