Web-based content

Android offers a variety of ways to present content to a user. To provide a user experience that's consistent with the rest of the platform, it's usually best to build a native app that incorporates framework-provided experiences, such as Android App Links or search. Additionally, you can use Google Play-based experiences, such as App Actions, where Google Play services is available. However, some apps might need increased control over the UI. In this case, a WebView is a good option for displaying trusted first-party content. For third-party web browsing, you may choose to use either Custom Tabs or WebViews, as either of these lets your app display content safely and dependably.

Figure 1 illustrates how you can provide access to your web pages from a browser or your own Android app. The WebView framework lets you specify viewport and style properties that make your web pages appear at the proper size and scale on all screen configurations for all major web browsers. You can define an interface between your Android app and your web pages that lets JavaScript in the web pages call APIs in your app, providing Android APIs to your web-based application.

However, don't develop an Android app as a means to view your website. Rather, the web pages you embed in your app must be designed specifically for that environment.

An image showing how to make your web content available to users
Figure 1. You can make your web content available to users in two ways:
in a traditional web browser or in an Android application that includes a WebView in the layout.

Alternatives to WebView

Although WebView objects provide increased control over the UI, there are alternatives that might provide similar functionality with less configuration, faster loading and performance, improved privacy protections, and access to the browser's cookies.

Consider using these alternatives to WebView if your app falls into the following use cases:

  • If you want to send users to a mobile site, build a progressive web app (PWA).
  • If you want to display third-party web content outside of the app experience, send an intent to installed web browsers.
  • If you want to avoid leaving your app to open the browser, or you want to customize the browser's UI, consider Custom Tabs.
  • Figure 2. Comparison of Chrome, Chrome Custom Tabs, and WebView.

    Third-Party Embedded Web Browsing

    As a developer, you want to design your app with increased capabilities and enhanced user experiences. Of the many things to consider, you must think carefully about how you want your content displayed on mobile devices. You can determine how embedded content is consumed by default in your app. There is no one-size-fits-all solution, but there are recommended paths you can take to build a user-friendly app. When you want to enable an in-app browsing experience, you can choose to enlist the Custom Tabs option or the WebViews option.

    Custom Tabs

    WebViews

    Out-of-the-box ready browsing for 3rd party content handled by the user's default browser

    Custom developer controlled browsing experiences

    • Ease of integration: Integrating Custom Tabs is the simplest and easiest way to provide users an Embedded Web browsing experience
    • Shared state: Reduced user friction when logging into sites given shared cookies and permissions model with the browser
    • More advanced UI control of the browser view
    • Be able to modify the contents of the web page itself
    • Deeper developer analytic insight into engagement / activity
    • WebView updates roll out to all devices and users consistently and globally
    Whether you choose the Custom Tabs option or the WebViews option, you want to ensure that your embedded web pages are viewable on all screen specifications for all major web browsers. This attention to detail produces a great user experience and increased traffic to your app.

    Additional resources

    To develop web pages for Android-powered devices using WebView objects, see the following documents: