我有一个 android 应用程序,它使用 web 视图加载一个网页,该网页有一个谷歌地图和一些 javascript,android 应用程序可以与之交互以绘制图钉并在信息框点击等时执行操作。
我通过 https 在实时生产服务器上托管我的页面。
所以我让我的网络视图像这样加载页面:
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);
现在,当我通过 eclipse 运行应用程序时,使用和不使用 degu,它可以工作。Web 视图加载地图。互动作品。好的。
然后我导出一个签名的 APK。将 APK 复制到我的设备。安装它。运行。没有地图。我的 android 控件只是一个空白的白色 web 视图。是什么赋予了?任何人都可以提供任何建议吗?