I have an Android app that is basically just a webview that loads a html page written using Intel's App Framework 2.2. It was running fine since last year. However, on my new Samsung Note 4 that is running Android 5, the app loads, shows the first panel but I was unable to navigate to any links on the page. Any one have similar problem and managed to solve it?
Below is the relevant code for my app and the html.
_wv = (WebView)findViewById(R.id.browser);
WebSettings ws = _wv.getSettings();
ws.setJavaScriptEnabled(true);
ws.setUseWideViewPort(true);
_wv.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
//Log.d("SGC", "shouldOverrideUrlLoading " + url);
if (Uri.parse(url).getHost().equals(getString(R.string.app_url))) {
return false;
}
// Otherwise, give the default behavior (open in browser)
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
return true;
}
});
_wv.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress)
{
myToast.setText("Loading... " + progress + "%");
myToast.show();
}
});
_wv.loadUrl("http://" + getString(R.string.app_url) + "/" + getString(R.string.app_url_name) + "/index.html");
Layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${packageName}.${activityClass}" >
<WebView
android:id="@+id/browser"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
index.html:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes" />
<script src="../js/appframework.min.js" type="text/javascript"></script>
<script src="../js/appframework.ui.min.js" type="text/javascript"></script>
<link href="../css/af.ui.min.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="afui">
<div id="content">
<div class="panel" id="page_main" selected="selected" data-header="header_main">
<a href=“#page_product”>Products</a>
</div>
<div class="panel" id="page_product" data-header="header_back" >
<p>Our products</p>
<a href="#page_main">BACK</a>
</div>
</div>
<header id="header_main">
<h1>Company</h1>
</header>
<header id="header_back">
<h1>Our Products</h1>
</header>
</div>
</body>
</html>
Apparently it's appframework.ui.js that is giving the problem on Android 5 webview. I've attempted many remedies on the java app as well as the html but nothing works. Eventually, I have to upgrade the Intel's App Framework to version 3 to make it work again; and it seems to work for the lower Android versions too.