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

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

        <legend id='Vb4mM'><style id='Vb4mM'><dir id='Vb4mM'><q id='Vb4mM'></q></dir></style></legend>
          <bdo id='Vb4mM'></bdo><ul id='Vb4mM'></ul>

        在 Android 2.0+ 的 WebView 中使用 navigator.geolocation.

        Using navigator.geolocation.getCurrentPosition in WebView on Android 2.0+ (PhoneGap related)(在 Android 2.0+ 的 WebView 中使用 navigator.geolocation.getCurrentPosition(PhoneGap 相關))
          <i id='qGDEE'><tr id='qGDEE'><dt id='qGDEE'><q id='qGDEE'><span id='qGDEE'><b id='qGDEE'><form id='qGDEE'><ins id='qGDEE'></ins><ul id='qGDEE'></ul><sub id='qGDEE'></sub></form><legend id='qGDEE'></legend><bdo id='qGDEE'><pre id='qGDEE'><center id='qGDEE'></center></pre></bdo></b><th id='qGDEE'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='qGDEE'><tfoot id='qGDEE'></tfoot><dl id='qGDEE'><fieldset id='qGDEE'></fieldset></dl></div>
        • <small id='qGDEE'></small><noframes id='qGDEE'>

            <tbody id='qGDEE'></tbody>

            <tfoot id='qGDEE'></tfoot>
            • <legend id='qGDEE'><style id='qGDEE'><dir id='qGDEE'><q id='qGDEE'></q></dir></style></legend>
              • <bdo id='qGDEE'></bdo><ul id='qGDEE'></ul>

                  本文介紹了在 Android 2.0+ 的 WebView 中使用 navigator.geolocation.getCurrentPosition(PhoneGap 相關)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我一直在使用 PhoneGap,它非常棒,但我在 Verizon Droid w/2.0.1 上獲取位置時遇到了問題(在 G1 w/1.6 上按預期工作).

                  I've been working with PhoneGap and it's been great, but I've run into a problem with getting location on a Verizon Droid w/ 2.0.1 (works as expected on a G1 w/ 1.6).

                  GeoLocation API 支持已在 2.0 (Eclair) 中添加到 Android,它可以在 Verizon Droid(2.0.1 上)的默認瀏覽器中運行.也就是說,如果我訪問一個調用 navigator.geolocation.getCurrentPosition(success_callback, error_callback) 的網站,設備會在帶有共享位置"或拒絕"選項的對話框中提示當前域想知道你的位置".如果我選擇共享位置",success_callback 最終會被調用位置數據.

                  GeoLocation API Support was added to Android in 2.0 (Eclair) and it works in the default browser on a Verizon Droid (on 2.0.1). That is, if I visit a website that calls navigator.geolocation.getCurrentPosition(success_callback, error_callback), the device prompts that the current domain "wants to know your location" in a dialog with options to "Share location" or "decline". If I select "Share location", success_callback eventually gets called with location data.

                  如果我在 WebView 中訪問同一個網站,對 navigator.geolocation.getCurrentPosition 的調用不會生成 javascript 錯誤,但不會顯示共享您的位置"對話框,也不會調用任何回調.在 logcat 中,我看到似乎是一個相關的錯誤:02-15 10:37:00.413: ERROR/geolocationService(16871): Caught security exception registering for location updates from system. 這應該只發生在 DumpRenderTree 中."

                  If I visit the same website in a WebView, the call to navigator.geolocation.getCurrentPosition does not generate a javascript error, but the "share your location" dialog is not displayed and neither callback ever gets called. In logcat, I see what seems to be a related error: "02-15 10:37:00.413: ERROR/geolocationService(16871): Caught security exception registering for location updates from system. This should only happen in DumpRenderTree."

                  在我看來,WebView 未能注冊位置更新,因為它沒有所需的權限,而這又是未提示用戶獲得權限的結果.盡管在 Android 2.0 中的 Webkit 包中添加了幾個與 GeoPermissions 相關的方法和對象,但我無法使用它們中的任何一個來使 WebView 顯示 GeoPermission 對話框.

                  It seems to me that the WebView is failing to register for location updates because it does not have the required permission, which in turn is a result of not prompting the user for the permission. Although there were several methods and objects added to the Webkit package in Android 2.0 related to GeoPermissions, I haven't been able to use any of them to cause WebView to display the GeoPermission dialog.

                  以下內容基于 Android 開發人員指南中的 Hello, WebView 示例,但它添加了一些在 2.0 中添加的與 GeoPermissions 相關的調用和對象.*使用適當的 url 更新(獲得 的許可作者 - 感謝 Oliver!).

                  The following is based on the Hello, WebView example from the Android Developer's Guide but it adds some of the calls and objects that were added in 2.0 related to GeoPermissions. *Updated with an appropriate url (with permission from the author - thanks Oliver!).

                  有沒有人能夠讓這個工作?任何反饋都會很棒,謝謝!

                  Has anyone been able to get this working? Any feedback would be great, thanks!

                  package com.example.android.helloactivity;
                  
                  import android.app.Activity;
                  import android.os.Bundle; 
                  import android.webkit.GeolocationPermissions;
                  import android.webkit.WebChromeClient;
                  import android.webkit.WebView;
                  import android.webkit.GeolocationPermissions.Callback;
                  
                  public class HelloActivity extends Activity implements GeolocationPermissions.Callback{
                  
                  WebView webview;
                  String geoWebsiteURL = "http://maxheapsize.com/static/html5geolocationdemo.html";
                  public HelloActivity() {
                  }
                  
                  /**
                   * Called with the activity is first created.
                   */
                  @Override
                  public void onCreate(Bundle savedInstanceState) {
                      super.onCreate(savedInstanceState);
                  
                      setContentView(R.layout.hello_activity);
                  
                      webview = (WebView) findViewById(R.id.webview);
                      webview.getSettings().setJavaScriptEnabled(true);
                      webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
                      webview.getSettings().setGeolocationEnabled(true);  //seems like if i set this, the webview should prompt when I call navigator.geolocation.getCurrentPosition
                      GeolocationPermissions geoPerm = new GeolocationPermissions(); //added in API Level 5 but no methods exposed until API level 7
                      GeoClient geo = new GeoClient();
                      webview.setWebChromeClient(geo);        
                      String origin = ""; //how to get origin in correct format?
                      geo.onGeolocationPermissionsShowPrompt(origin, this);  //obviously not how this is meant to be used but expected usage not documented
                      webview.loadUrl(geoWebsiteURL);        
                  
                  }
                  
                  public void invoke(String origin, boolean allow, boolean remember) {
                  
                  }
                  
                  final class GeoClient extends WebChromeClient {
                  
                  @Override
                  public void onGeolocationPermissionsShowPrompt(String origin,
                  Callback callback) {
                  // TODO Auto-generated method stub
                  super.onGeolocationPermissionsShowPrompt(origin, callback);
                  callback.invoke(origin, true, false);
                  }
                  
                  }
                  
                  }
                  

                  推薦答案

                  我剛剛在裝有 Android 2.1 的 Nexus One 上試用了您的代碼,它運行良好.請記住,您需要為清單添加必要的權限:

                  I just tried your code on a Nexus One with Android 2.1, and it works fine. Remember that you'll need to add the necessary permissions to your manifest:

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

                  這篇關于在 Android 2.0+ 的 WebView 中使用 navigator.geolocation.getCurrentPosition(PhoneGap 相關)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 或網絡提供商)
                  1. <i id='Lywvh'><tr id='Lywvh'><dt id='Lywvh'><q id='Lywvh'><span id='Lywvh'><b id='Lywvh'><form id='Lywvh'><ins id='Lywvh'></ins><ul id='Lywvh'></ul><sub id='Lywvh'></sub></form><legend id='Lywvh'></legend><bdo id='Lywvh'><pre id='Lywvh'><center id='Lywvh'></center></pre></bdo></b><th id='Lywvh'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Lywvh'><tfoot id='Lywvh'></tfoot><dl id='Lywvh'><fieldset id='Lywvh'></fieldset></dl></div>
                  2. <legend id='Lywvh'><style id='Lywvh'><dir id='Lywvh'><q id='Lywvh'></q></dir></style></legend>
                    <tfoot id='Lywvh'></tfoot>

                      <bdo id='Lywvh'></bdo><ul id='Lywvh'></ul>

                          <tbody id='Lywvh'></tbody>

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

                          • 主站蜘蛛池模板: 欧美一级欧美一级在线播放 | 亚洲高清在线 | 99热这里都是精品 | 久久久久免费观看 | 亚洲另类视频 | 91视频久久| 国产精品欧美一区二区 | 日韩激情在线 | 孰女乱色一区二区三区 | 午夜激情视频在线 | 国产高清自拍视频在线观看 | 成人在线中文字幕 | 国产精品性做久久久久久 | 亚洲精品在线播放 | 中文字幕在线看第二 | 国产精品日韩欧美一区二区三区 | 亚洲一区二区三区在线播放 | 久久69精品久久久久久久电影好 | 一级a性色生活片久久毛片 午夜精品在线观看 | 性高朝久久久久久久3小时 av一区二区三区四区 | 中文字幕日韩欧美一区二区三区 | 亚洲精品无人区 | 久久激情视频 | 精品视频一区二区三区 | 青青草久久 | 国产成人91视频 | 国产日产精品一区二区三区四区 | 在线一区二区国产 | 国产精品久久久久久久久久 | 成人做爰69片免费观看 | 亚洲第一在线视频 | 欧美激情一区二区三区 | 黄网站免费在线观看 | 国产剧情一区二区三区 | 日韩综合网 | 成人3d动漫一区二区三区91 | 日本久久一区二区三区 | 国产精品亚洲精品日韩已方 | 亚洲第一成人av | 精品国产乱码久久久久久蜜柚 | 亚洲乱码国产乱码精品精98午夜 |