私は、ウェブビューを使用してグーグルマップといくつかのJavaScriptを含むウェブページをロードするアンドロイドアプリを持っています。これは、アンドロイドアプリがピンをプロットし、情報ボックスのクリックなどでアクションを実行するために対話できます。
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);
これで、degubを使用した場合と使用しない場合で、Eclipseを介してアプリを実行すると、機能します。Webビューはマップをロードします。相互作用は機能します。良い。
次に、署名されたAPKをエクスポートします。APKをデバイスにコピーします。インストールします。それを実行します。地図はありません。私のAndroidコントロールを備えた空白の白いWebビュー。何が得られますか?誰かアドバイスはありますか?