Displaying Mobile WordPress in Android

I'm currently working on an app for a website/class. Currently, it pulls the RSS feed of the site, parses it appropriately, and when an item is clicked, it launches a new Activity with a WebView to display the page.

My current problem is that on smaller devices, such as the HTC One or Samsung Stratosphere, it defaults to showing the mobile version of the site. This is precisely what I want to happen across all devices, but on my Samsung Galaxy Note 8, it defaults to loading the desktop version of the page.

Is anyone familiar with WordPress and Android and can help me force the WebView on the Galaxy (and, therefore, other devices) to load the mobile page by default?

Thank you!

Answers


Use WebSettings object obtained by the WebView's getSettings() Method and change the UserAgent string.

WebSetting settings = webView.getSettings();
settings.setUserAgentString("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0");

For current Firefox 26.0 or browser of your choice. This should force the Website to display in Desktop mode, since this is what the Websites do to determine if they serve a mobile or desktop version.

Update: You an also force it mobile by using mobile UserAgent. For more information check out this website with example UserAgents.

Some examples for historical references if the link becomes invalid:

Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

Mozilla/5.0 (Linux; U; Android 4.0.3; de-ch; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

http://www.useragentstring.com/pages/useragentstring.php

WebSettings


Need Your Help

ado.net data services silverlight security

.net wcf-security wcf-data-services astoria

I have a application where the validation is done in the web server side (in the page). and the control is passed to the sl client. The SL client makes call to the ado.net data services for its que...

Java EE deployment error

java netbeans ant java-ee glassfish

While deploying a particular project I'm getting deployment error like "module has not been deployed"... but I'm able to deploy other projects... the error shown is as follows