久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='EnCwX'><style id='EnCwX'><dir id='EnCwX'><q id='EnCwX'></q></dir></style></legend>
    1. <tfoot id='EnCwX'></tfoot>

      • <bdo id='EnCwX'></bdo><ul id='EnCwX'></ul>
        <i id='EnCwX'><tr id='EnCwX'><dt id='EnCwX'><q id='EnCwX'><span id='EnCwX'><b id='EnCwX'><form id='EnCwX'><ins id='EnCwX'></ins><ul id='EnCwX'></ul><sub id='EnCwX'></sub></form><legend id='EnCwX'></legend><bdo id='EnCwX'><pre id='EnCwX'><center id='EnCwX'></center></pre></bdo></b><th id='EnCwX'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='EnCwX'><tfoot id='EnCwX'></tfoot><dl id='EnCwX'><fieldset id='EnCwX'></fieldset></dl></div>
      1. <small id='EnCwX'></small><noframes id='EnCwX'>

      2. Android:使用 html5 使用 javascript api 確定 webview 中的

        Android: Using html5 to determine geolocation in webview with javascript api(Android:使用 html5 使用 javascript api 確定 webview 中的地理位置)
        <tfoot id='fSDla'></tfoot>
          <legend id='fSDla'><style id='fSDla'><dir id='fSDla'><q id='fSDla'></q></dir></style></legend>

          <small id='fSDla'></small><noframes id='fSDla'>

            • <bdo id='fSDla'></bdo><ul id='fSDla'></ul>

              <i id='fSDla'><tr id='fSDla'><dt id='fSDla'><q id='fSDla'><span id='fSDla'><b id='fSDla'><form id='fSDla'><ins id='fSDla'></ins><ul id='fSDla'></ul><sub id='fSDla'></sub></form><legend id='fSDla'></legend><bdo id='fSDla'><pre id='fSDla'><center id='fSDla'></center></pre></bdo></b><th id='fSDla'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='fSDla'><tfoot id='fSDla'></tfoot><dl id='fSDla'><fieldset id='fSDla'></fieldset></dl></div>

                    <tbody id='fSDla'></tbody>
                  本文介紹了Android:使用 html5 使用 javascript api 確定 webview 中的地理位置的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我目前在 web 視圖中遇到地理定位問題.我有一個網絡應用程序.我目前沒有使用 phonegap 或任何其他移動框架.我無法讓內置的 html5 地理定位 javascript api 用于在 android 應用程序的 webview 中運行的應用程序.該網站在 android 2.0+(支持地理位置)上的 chrome 瀏覽器上運行良好.

                  I'm currently having an issue with geolocation in a webview. I have a webapp. I'm currently not using phonegap or any other mobile framework. I've been unsuccessful at getting the built-in html5 geolocation javascript api to work on an application that runs in a webview in an android app. The site works fine otherwise from the chrome browser on android 2.0+ (geolocation supported).

                  我正在針對 android api 版本 5 進行編譯.

                  I'm compiling against android api version 5.

                  我讀過這篇文章已經

                  Phonegap 的解決方案是編寫一個封裝內置調用并使用主機活動的代理,但我更喜歡在不使用電話間隙的情況下使用內置到 webview (webkit).

                  Phonegap's solution of writing a proxy which wraps the built in call and uses the host activity instead is good, but I'd prefer to use the built in to the webview (webkit) without using phone gap.

                  我已經在清單文件中設置了適當的權限:

                  I've set the proper permissions in the manifest file:

                  <uses-permission android:name="android.permission.INTERNET" />
                  <uses-permission android:name="android.permission.ACCESS_GPS" />
                  <uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
                  <uses-permission android:name="android.permission.ACCESS_LOCATION" />
                  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
                  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
                  

                  這是一個示例代碼片段:

                  Here is an example code snippet:

                  webview = (WebView) findViewById(R.id.webview);
                  pbarDialog = new ProgressDialog(this);
                  pbarDialog.setCancelable(false);
                  pbarDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                  webview.setWebViewClient(new MyWebViewClient());
                  webview.getSettings().setJavaScriptEnabled(true);
                  webview.setWebChromeClient(new MyChromeWebViewClient());
                  webview.setVerticalScrollBarEnabled(false);
                  WebSettings webSettings = webview.getSettings();
                  webSettings.setSavePassword(true);
                  webSettings.setSaveFormData(true);
                  webSettings.setJavaScriptEnabled(true);
                  webSettings.setSupportZoom(false);
                  webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
                  webSettings.setGeolocationEnabled(true);
                  

                  ...

                  private class MyChromeWebViewClient extends WebChromeClient {
                  
                  @Override
                  public void onProgressChanged(WebView view, int progress) {
                      // Activities and WebViews measure progress with different scales.
                      // The progress meter will automatically disappear when we reach 100%
                      activity.setProgress(progress * 100);
                  }
                  
                  @Override
                  public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
                      Log.d(LOG_TAG, message);
                      // This shows the dialog box.  This can be commented out for dev
                      AlertDialog.Builder alertBldr = new AlertDialog.Builder(activity);
                      alertBldr.setMessage(message);
                      alertBldr.setTitle("Alert");
                      alertBldr.show();
                      result.confirm();
                      return true;
                    }
                  
                  }
                  
                  private class MyWebViewClient extends WebViewClient {
                  
                  @Override
                  public boolean shouldOverrideUrlLoading(WebView view, String url) {
                      view.loadUrl(url);
                      return true;
                  }
                  
                  @Override
                  public void onReceivedError(WebView view, int errorCode,
                      String description, String failingUrl) {
                      }
                  }
                  

                  有沒有其他人在讓 web 應用程序在 webview 中工作時遇到問題?

                  Has anyone else had issues with getting a web application to work in the webview?

                  推薦答案

                  onGeolocationPermissionsShowPrompt() 添加到 MyChromeWebViewClient 如下:

                  Add onGeolocationPermissionsShowPrompt() to MyChromeWebViewClient as below:

                  private class MyChromeWebViewClient extends WebChromeClient {
                  
                      @Override
                      public void onProgressChanged(WebView view, int progress) {
                          // Activities and WebViews measure progress with different scales.
                          // The progress meter will automatically disappear when we reach 100%
                          activity.setProgress(progress * 100);
                      }
                  
                      @Override
                      public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
                          Log.d(LOG_TAG, message);
                          // This shows the dialog box.  This can be commented out for dev
                          AlertDialog.Builder alertBldr = new AlertDialog.Builder(activity);
                          alertBldr.setMessage(message);
                          alertBldr.setTitle("Alert");
                          alertBldr.show();
                          result.confirm();
                          return true;
                      }
                  
                      public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
                          callback.invoke(origin, true, false);
                      }
                  }
                  

                  您需要導入android.webkit.GeolocationPermissions".

                  添加此權限:

                  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
                  

                  我猜這會奏效.

                  這篇關于Android:使用 html5 使用 javascript api 確定 webview 中的地理位置的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Help calculating X and Y from Latitude and Longitude in iPhone(幫助從 iPhone 中的緯度和經度計算 X 和 Y)
                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                  IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                  How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                  CLLocation returning negative speed(CLLocation 返回負速度)
                  How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網絡提供商)

                  • <small id='Qq82n'></small><noframes id='Qq82n'>

                      1. <legend id='Qq82n'><style id='Qq82n'><dir id='Qq82n'><q id='Qq82n'></q></dir></style></legend>

                            <tbody id='Qq82n'></tbody>

                            <bdo id='Qq82n'></bdo><ul id='Qq82n'></ul>
                            <i id='Qq82n'><tr id='Qq82n'><dt id='Qq82n'><q id='Qq82n'><span id='Qq82n'><b id='Qq82n'><form id='Qq82n'><ins id='Qq82n'></ins><ul id='Qq82n'></ul><sub id='Qq82n'></sub></form><legend id='Qq82n'></legend><bdo id='Qq82n'><pre id='Qq82n'><center id='Qq82n'></center></pre></bdo></b><th id='Qq82n'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Qq82n'><tfoot id='Qq82n'></tfoot><dl id='Qq82n'><fieldset id='Qq82n'></fieldset></dl></div>
                            <tfoot id='Qq82n'></tfoot>
                          • 主站蜘蛛池模板: 欧美专区在线视频 | 美女131mm久久爽爽免费 | 免费观看av | 国产午夜亚洲精品不卡 | 成人字幕网zmw | 精品一区二区电影 | 国产在线视频一区二区 | 亚洲精品一级 | 亚洲男人天堂网 | 亚洲综合在线视频 | 久久在线 | 天天久久| 日韩久久综合网 | 99爱在线免费观看 | 精品久久久久久久 | 午夜久久久久 | 国产精品一区二区三区在线 | av激情在线 | 日本午夜免费福利视频 | 国产又色又爽又黄又免费 | 国产一区二区三区 | 久久久久久久久久久久一区二区 | 亚洲高清在线 | 国产精品美女久久久久 | 中文字字幕一区二区三区四区五区 | 干干天天 | 国产不卡在线播放 | 久久久毛片 | 成人毛片网| 人人鲁人人莫人人爱精品 | 国产日韩精品视频 | 狠狠色网| 亚洲精品久久久久久久久久久久久 | 一区二区免费在线视频 | 婷婷丁香综合网 | 羞羞的视频在线 | 一级毛片视频在线观看 | 欧美精品欧美精品系列 | 成人国产在线视频 | 最新免费视频 | 狠狠爱综合网 |