I have a problem with my Android browser. The application works fine on some devices, but doesn’t download the mobile version, when I use Sony Acro S, it always downloads the web version. The first time, I think, maybe this is my version of Android (4.1.2), but I tried on a different device with the same version of os (4.1.2), and the result is a downloadable version of the device, not the web version. Here is my code,
public class MainActivity extends Activity
{private browser WebView;
private ProgressBar progressBar;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
browser = (WebView) findViewById(R.id.webkit);
WebIconDatabase.getInstance().open(getDir("icons", MODE_PRIVATE).getPath());
browser.getSettings().setJavaScriptEnabled(true);
browser.getSettings().setBuiltInZoomControls(false);
browser.getSettings().setGeolocationEnabled(true);
browser.getSettings().setAppCacheEnabled(true);
browser.getSettings().setDatabaseEnabled(true);
browser.getSettings().setDomStorageEnabled(true);
browser.getSettings().setGeolocationEnabled(true);
Parse.initialize(this, "", "");
ParseAnalytics.trackAppOpened(getIntent());
PushService.setDefaultPushCallback(this, MainActivity.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
browser.getSettings().setPluginState(PluginState.ON);
I am trying to use this code,
browser.getSettings() .setUserAgentString("Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3");
I have the same result. Can someone help me solve my problem? Thanks x
source
share