use*_*421 6 google-maps android-maps android-4.0-ice-cream-sandwich google-places-api google-places
我按照本教程:http://android-er.blogspot.com/2013/03/embed-google-map-in-webview.html
我试图在WebView中使用Google Map,但它无法获取我当前的位置.我在WebView上启用了JavaScript.我还需要启用什么?
有谁知道为什么会这样?它不应该促使我使用我当前的位置?
请注意,我对使用MapView作为替代方案不感兴趣.我想知道我需要在WebView上设置什么,或者可能在设备的位置服务上?
onGeolocationPermissionsShowPrompt您应该通过重写以下方法来允许 Web 视图访问您的位置:
webView.setWebChromeClient(new WebChromeClient(){
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
callback.invoke(origin, true, false);
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7044 次 |
| 最近记录: |