Change UserAgent in Android WebView apps 📲

Want to identify WebView client accesses? Makes sense, you can use it for tracking/analytics purposes and for separating web browser and WebView client accesses to optimize/modify the style or content.

The default WebView UserAgent looks like this:

Mozilla/5.0 (Linux; U; Android 4.1.1; en-gb; Build/KLP) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30

(more information here). So let’s change it:


public static final String USER_AGENT = "Custom UserAgent here";



Here is the good news: If you use the WebViewGold Android Studio template, you do not need to worry about the whole custom UserAgent mechanisms, just enter the customized UserAgent in the configuration file:


Download the WebViewGold template for Android Studio here.
or book our full all-inclusive WeSetupYourWebViewApp service.
Any questions? Just email us! 🙂