pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  • <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="v376was" 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="vyitofk" 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="qx3hndu" id='Qq82n'><tfoot id='Qq82n'></tfoot><dl id='Qq82n'><fieldset id='Qq82n'></fieldset></dl></div>
                            <tfoot id='Qq82n'></tfoot>
                          • 主站蜘蛛池模板: 水轮机密封网 | 水轮机密封产品研发生产厂家| 盘扣式脚手架-附着式升降脚手架-移动脚手架,专ye承包服务商 - 苏州安踏脚手架工程有限公司 | 泰安办公家具-泰安派格办公用品有限公司 | 房在线-免费房产管理系统软件-二手房中介房屋房源管理系统软件 | 阁楼货架_阁楼平台_仓库仓储设备_重型货架_广州金铁牛货架厂 | 背压阀|减压器|不锈钢减压器|减压阀|卫生级背压阀|单向阀|背压阀厂家-上海沃原自控阀门有限公司 本安接线盒-本安电路用接线盒-本安分线盒-矿用电话接线盒-JHH生产厂家-宁波龙亿电子科技有限公司 | 膜片万向弹性联轴器-冲压铸造模具「沧州昌运模具」 | 螺旋绞龙叶片,螺旋输送机厂家,山东螺旋输送机-淄博长江机械制造有限公司 | 皮带输送机-大倾角皮带输送机-皮带输送机厂家-河南坤威机械 | 石家庄小程序开发_小程序开发公司_APP开发_网站制作-石家庄乘航网络科技有限公司 | 桐城新闻网—桐城市融媒体中心主办 | 亚克力制品定制,上海嘉定有机玻璃加工制作生产厂家—官网 | 暖气片十大品牌厂家_铜铝复合暖气片厂家_暖气片什么牌子好_欣鑫达散热器 | 塑胶跑道施工-硅pu篮球场施工-塑胶网球场建造-丙烯酸球场材料厂家-奥茵 | 企业管理培训,企业培训公开课,企业内训课程,企业培训师 - 名课堂企业管理培训网 | 铝箔袋,铝箔袋厂家,东莞铝箔袋,防静电铝箔袋,防静电屏蔽袋,防静电真空袋,真空袋-东莞铭晋让您的产品与众不同 | 有机肥设备生产制造厂家,BB掺混肥搅拌机、复合肥设备生产线,有机肥料全部加工设备多少钱,对辊挤压造粒机,有机肥造粒设备 -- 郑州程翔重工机械有限公司 | ptc_浴霸_大巴_干衣机_呼吸机_毛巾架_电动车加热器-上海帕克 | 湖南自考_湖南自学考试网| 超声波焊接机,振动摩擦焊接机,激光塑料焊接机,超声波焊接模具工装-德召尼克(常州)焊接科技有限公司 | 档案密集柜_手动密集柜_智能密集柜_内蒙古档案密集柜-盛隆柜业内蒙古密集柜直销中心 | 电磁辐射仪-电磁辐射检测仪-pm2.5检测仪-多功能射线检测仪-上海何亦仪器仪表有限公司 | 绿萝净除甲醛|深圳除甲醛公司|测甲醛怎么收费|培训机构|电影院|办公室|车内|室内除甲醛案例|原理|方法|价格立马咨询 | 知网论文检测系统入口_论文查重免费查重_中国知网论文查询_学术不端检测系统 | 细沙回收机-尾矿干排脱水筛设备-泥石分离机-建筑垃圾分拣机厂家-青州冠诚重工机械有限公司 | 无痕胶_可移胶_无痕双面胶带_可移无痕胶厂家-东莞凯峰 | 磁力反应釜,高压釜,实验室反应釜,高温高压反应釜-威海自控反应釜有限公司 | 考勤系统_考勤管理系统_网络考勤软件_政企|集团|工厂复杂考勤工时统计排班管理系统_天时考勤 | 小型铜米机-干式铜米机-杂线全自动铜米机-河南鑫世昌机械制造有限公司 | 北京网络营销推广_百度SEO搜索引擎优化公司_网站排名优化_谷歌SEO - 北京卓立海创信息技术有限公司 | 塑料异型材_PVC异型材_封边条生产厂家_PC灯罩_防撞扶手_医院扶手价格_东莞市怡美塑胶制品有限公司 | 儋州在线-儋州招聘找工作、找房子、找对象,儋州综合生活信息门户! | 股票入门基础知识_股票知识_股票投资大师_格雷厄姆网 | 首页 - 军军小站|张军博客 | 恒温恒湿试验箱厂家-高低温试验箱维修价格_东莞环仪仪器_东莞环仪仪器 | 活性炭厂家-蜂窝活性炭-粉状/柱状/果壳/椰壳活性炭-大千净化-活性炭 | 炭黑吸油计_测试仪,单颗粒子硬度仪_ASTM标准炭黑自销-上海贺纳斯仪器仪表有限公司(HITEC中国办事处) | 臭氧灭菌箱-油桶加热箱-原料桶加热融化烘箱-南京腾阳干燥设备厂 臭氧发生器_臭氧消毒机 - 【同林品牌 实力厂家】 | FFU_空气初效|中效|高效过滤器_空调过滤网-广州梓净净化设备有限公司 | 截齿|煤截齿|采煤机截齿|掘进机截齿|旋挖截齿-山东卓力截齿厂家报价 | 南京精锋制刀有限公司-纵剪机刀片_滚剪机刀片_合金刀片厂家 |