I have an android app that uses a web view to load a web page that have a google map and some javascript that the android app can interact with to plot pins and do actions on info box clicks etc.
I'm hosting my page on a live production server over https.
So I have my web view load the page like so:
String mapViewUrl = "https://mywebsite.com/mywebsite/MyMapApp/Default.html";
in OnCreate:
webMapView = (WebView) findViewById(R.id.webMapView);
webMapView.getSettings().setJavaScriptEnabled(true);
webMapView.addJavascriptInterface(new JavaScriptInterface(this), "android");
webMapView.getSettings().setPluginsEnabled(true);
webMapView.getSettings().setDomStorageEnabled(true);
webMapView.getSettings().setBuiltInZoomControls(true);
webMapView.getSettings().setSupportZoom(true);
webMapView.getSettings().setAllowFileAccess(true);
webMapView.getSettings().setGeolocationEnabled(true);
final String centerURL = "javascript:centerAt(" + lat + "," + lon + ")";
//Wait for the page to load then send the location information
webMapView.setWebViewClient(new WebViewClient(){
@Override
public void onPageFinished(WebView view, String url){
webMapView.loadUrl(centerURL);
}
});
webMapView.loadUrl(mapViewUrl);
Now when I run the app through eclipse, with and w/o degub, it works. Web view loads the map. Interaction works. Nice.
I then export a signed APK. Copy the APK to my device. Install it. Run it. No map. Just a blank white web view with my android controls. What gives? Can anyone offer any advice?