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

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

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

    2. <tfoot id='znALt'></tfoot>

          <bdo id='znALt'></bdo><ul id='znALt'></ul>
      1. <i id='znALt'><tr id='znALt'><dt id='znALt'><q id='znALt'><span id='znALt'><b id='znALt'><form id='znALt'><ins id='znALt'></ins><ul id='znALt'></ul><sub id='znALt'></sub></form><legend id='znALt'></legend><bdo id='znALt'><pre id='znALt'><center id='znALt'></center></pre></bdo></b><th id='znALt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='znALt'><tfoot id='znALt'></tfoot><dl id='znALt'><fieldset id='znALt'></fieldset></dl></div>
      2. Phonegap 地理定位有時無法在 android 上運行

        Phonegap geolocation sometimes not working on android(Phonegap 地理定位有時無法在 android 上運行)
              <bdo id='mrUcN'></bdo><ul id='mrUcN'></ul>

              1. <small id='mrUcN'></small><noframes id='mrUcN'>

                <legend id='mrUcN'><style id='mrUcN'><dir id='mrUcN'><q id='mrUcN'></q></dir></style></legend>

                  <i id='mrUcN'><tr id='mrUcN'><dt id='mrUcN'><q id='mrUcN'><span id='mrUcN'><b id='mrUcN'><form id='mrUcN'><ins id='mrUcN'></ins><ul id='mrUcN'></ul><sub id='mrUcN'></sub></form><legend id='mrUcN'></legend><bdo id='mrUcN'><pre id='mrUcN'><center id='mrUcN'></center></pre></bdo></b><th id='mrUcN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='mrUcN'><tfoot id='mrUcN'></tfoot><dl id='mrUcN'><fieldset id='mrUcN'></fieldset></dl></div>
                1. <tfoot id='mrUcN'></tfoot>
                    <tbody id='mrUcN'></tbody>
                2. 本文介紹了Phonegap 地理定位有時無法在 android 上運行的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我使用cordova v3.4.1 來構建android 和ios 應用程序,在ios 上的地理定位功能返回非常快并且總是可以正常工作,但在android 上,有時它不工作.

                  I have using cordova v3.4.1 to build android and ios app, on ios geolocation function is returning very quickly and works fine always,but on android, sometimes it not working.

                  奇怪的是,在我重啟我的安卓手機后,它工作正常.在 wifi 和 3G 中,地理定位在幾個多小時內都非常迅速地獲得了位置.

                  The strange thing is after I reboot my android phone,it works fine. In more than a few hours geolocation gets the postion very quickly both in wifi and 3G.

                  但是過了幾個小時,我再次打開應用程序,地理定位無法工作.有時當我在外面時,它可以用gps衛(wèi)星定位,但速度很慢,經常出現超時錯誤.

                  But after serval hours, I open the app again, the geolocation can not work.Sometimes when I outside, it can get postion with gps satellite,but very slow,often occur timeout error.

                  我嘗試刪除該應用并重新安裝它,但問題仍然存在,除非重新啟動我的安卓手機.當我重新啟動我的安卓手機時,地理定位功能在未來幾個小時內再次正常工作.

                  I try to remove the app and reinstall it again,but the problem still exist,unless reboot my android phone.when I reboot my android phone,geolocation function is working fine again in future a few hours.

                  我測試過samsang note2、galaxy4等安卓手機,都出現同樣的問題.重啟后,他們可以非常快速地獲取位置.

                  I have test serval android`s phone such as samsang note2, galaxy4 etc, they all have the same problem.when I reboot it, they can get location very quicly.

                  這個問題困擾了我很久,有大神幫忙嗎?

                  This problem has troubled me for a long time, so somebody help me?

                  下面是我的代碼:

                  navigator.geolocation.getCurrentPosition(function(pos){
                                  cb(null,pos)
                              },function(errMsg){
                      navigator.geolocation.getCurrentPosition(function(pos){  
                              cb(null,pos)
                      },function(errMsg){
                      cb(errMsg)
                      }, {
                      enableHighAccuracy: true,
                      timeout: 60*1000*2,
                      maximumAge: 1000*60*10
                     });
                  }, {
                      enableHighAccuracy: false,
                      timeout: 10*1000,
                      maximumAge: 1000*60*10
                  });
                  

                  我的 config.xml:

                  my config.xml:

                  <feature name="Geolocation">
                      <param name="android-package" value="org.apache.cordova.geolocation.GeoBroker" />
                  </feature>
                  

                  推薦答案

                  終于解決了問題,現在在我的安卓手機上,getCurrentPosition函數每次都很快返回位置信息,我從來不需要再次重啟我的手機!我不確定 cordova v3.4.1 的地理定位插件是否有錯誤.

                  Finally I have solve the problem,now on my android phone, getCurrentPosition function return location infomation very quickly every time, I never need reboot my phone again! I'm not sure wether cordova v3.4.1’s geoloation plugin has bugs.

                  出現這個問題的原因是我們總是使用瀏覽器的navigator.geolocation.getCurrentPosition函數來定位位置,所以我們必須讓app使用cordova原生實現而不是html5.

                  The reason to occur this problem is we always to use browser's navigator.geolocation.getCurrentPosition function to locate the postion,so we must let app use cordova native implementation instead of html5.

                  這里是cordova v3.4.1的解決方案,希望對你有幫助,事實上它已經解決了我的問題.

                  Here is the the solution with cordova v3.4.1, hope it can help you,in fact it has resolved my question.

                  解決步驟:

                  1.刪除org.apache.cordova.geolocation

                  1.remove the org.apache.cordova.geolocation

                  $ cordova plugin rm org.apache.cordova.geolocation
                  

                  2.重新安裝一個新的 org.apache.cordova.geolocation 插件

                  2.reinstall a new org.apache.cordova.geolocation plugin

                  $ cordova plugin add org.apache.cordova.geolocation
                  

                  3.將插件復制到e:

                  進入插件文件夾,如‘YOUR_APP_FOLDERplugins’

                  enter the plugin folder,such as ‘YOUR_APP_FOLDERplugins’

                  將洞org.apache.cordova.geolocation復制到E:org.apache.cordova.geolocation

                  4.再次移除插件

                  $ cordova plugin rm org.apache.cordova.geolocation
                  

                  5.編輯E:org.apache.cordova.geolocationplugin.xml中的plugin.xml

                  如下編輯 plugin.xml 文件:

                  edit the plugin.xml file like below:

                  ... ...
                  <name>Geolocation</name>
                  <description>Cordova Geolocation Plugin</description>
                  <license>Apache 2.0</license>
                  <keywords>cordova,geolocation</keywords>
                  <repo>https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git</repo>
                  <issue>https://issues.apache.org/jira/browse/CB/component/12320638</issue>
                  
                  <!-- android Code Comments
                  <platform name="android">
                  
                      <config-file target="AndroidManifest.xml" parent="/*">
                          <uses-permissionandroid android:name="android.permission.ACCESS_COARSE_LOCATION" />
                          <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
                          <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
                      </config-file>
                  
                  </platform>
                  -->
                  
                   <!-- amazon-fireos change to android-->
                  <platform name="android"> 
                  
                      <js-module src="www/Coordinates.js" name="Coordinates">
                          <clobbers target="Coordinates" />
                      </js-module>
                  
                      <js-module src="www/PositionError.js" name="PositionError">
                          <clobbers target="PositionError" />
                      </js-module>
                  
                      <js-module src="www/Position.js" name="Position">
                          <clobbers target="Position" />
                      </js-module>
                  
                      <js-module src="www/geolocation.js" name="geolocation">
                          <clobbers target="navigator.geolocation" />
                      </js-module>
                  
                      <config-file target="res/xml/config.xml" parent="/*">
                          <feature name="Geolocation">
                              <param name="android-package" value="org.apache.cordova.geolocation.GeoBroker"/>
                          </feature>
                      </config-file>
                  
                      <config-file target="AndroidManifest.xml" parent="/*">
                          <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
                          <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
                          <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
                      </config-file>
                  
                      <source-file src="src/amazon/GeoBroker.java" target-dir="src/org/apache/cordova/geolocation" />
                      <source-file src="src/amazon/GPSListener.java" target-dir="src/org/apache/cordova/geolocation" />
                      <source-file src="src/amazon/NetworkListener.java" target-dir="src/org/apache/cordova/geolocation" />
                      <source-file src="src/amazon/CordovaLocationListener.java" target-dir="src/org/apache/cordova/geolocation" />
                  
                  </platform>
                  
                  <!-- ios -->
                  <platform name="ios">
                  ... ...
                  

                  6.再次添加插件

                  $ cordova plugin add E:org.apache.cordova.geolocation
                  

                  7、運行build commond

                  7、run build commond

                  $ cordova build android
                  

                  8.檢查是否正常

                  檢查 YOUR_APPpluginsandroid.json 必須包括:

                  {
                     "xml": "<feature name="Geolocation"><param name="android-package" value="org.apache.cordova.geolocation.GeoBroker" /></feature>",
                     "count": 1
                  },
                  ... ...
                  {
                    "xml": "<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />",
                    "count": 4
                  },
                  {
                     "xml": "<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />",
                      "count": 4
                  },
                  {
                    "xml": "<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />",
                    "count": 1
                   }
                  

                  檢查 YOUR_APPplatformsandroidAndroidManifest.xml 必須包括:

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

                  檢查 YOUR_APPplatformsandroid esxmlconfig.xml 必須包括:

                  <feature name="Geolocation">
                      <param name="android-package" value="org.apache.cordova.geolocation.GeoBroker" />
                  </feature>
                  

                  9.運行應用程序

                  編寫地理定位代碼以獲取 lat 和 lng:

                  write the geelocation code to get lat and lng:

                  navigator.geolocation.getCurrentPosition(function(pos){
                              alert('suc')
                              alert(JSON.stringify(pos))
                          },function(errMsg){
                                 alert(JSON.stringify(errMsg))
                                 navigator.geolocation.getCurrentPosition(function(pos){  
                                   alert('suc')
                                   alert(JSON.stringify(pos))
                                 },function(errMsg){
                                   alert(JSON.stringify(errMsg))
                                 }, {
                                 enableHighAccuracy: true,
                                 timeout: 60*1000*2,
                                 maximumAge: 1000*60*10
                                 });
                            }, {
                  enableHighAccuracy: false,
                  timeout: 60*1000,
                  maximumAge: 1000*60*10
                  

                  });

                  如果您的手機支持使用 wifi/3G 定位,那么我們將立即獲取位置,否則您將看到 errMsg 超時,然后 geolocation 將使用 gps 定位位置本機實現.

                  if your phone support use wifi/3G locate then we will get location immediately,else you will see the errMsg timeout and then geolocation will use gps to locate postion with native implement.

                  現在我們得到了 lat 和 lng,再也不需要重啟安卓手機了,謝天謝地.

                  now we get the lat and lng, and never need reboot the android phone agian,thank goodness.

                  如果還是有問題,嘗試安裝插件清理webview緩存:

                  if you still have the problem,try to install the plugin to clean the webview cache:

                  https://github.com/moderna/cordova-plugin-cache

                  這篇關于Phonegap 地理定位有時無法在 android 上運行的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  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 或網絡提供商)
                  • <legend id='42FFW'><style id='42FFW'><dir id='42FFW'><q id='42FFW'></q></dir></style></legend>
                      <tbody id='42FFW'></tbody>
                      <tfoot id='42FFW'></tfoot>
                      • <small id='42FFW'></small><noframes id='42FFW'>

                          <bdo id='42FFW'></bdo><ul id='42FFW'></ul>

                            <i id='42FFW'><tr id='42FFW'><dt id='42FFW'><q id='42FFW'><span id='42FFW'><b id='42FFW'><form id='42FFW'><ins id='42FFW'></ins><ul id='42FFW'></ul><sub id='42FFW'></sub></form><legend id='42FFW'></legend><bdo id='42FFW'><pre id='42FFW'><center id='42FFW'></center></pre></bdo></b><th id='42FFW'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='42FFW'><tfoot id='42FFW'></tfoot><dl id='42FFW'><fieldset id='42FFW'></fieldset></dl></div>
                          1. 主站蜘蛛池模板: 亚洲成av人影片在线观看 | 伊人中文字幕 | 亚洲视频一区在线观看 | 久久精品国产一区二区电影 | 99re国产视频| www.狠狠干| 日本黄色片免费在线观看 | 成人妇女免费播放久久久 | 日日骚视频 | 高清一区二区三区 | 午夜a√ | 日日摸日日添日日躁av | 91精品国模一区二区三区 | www.se91 | 欧美日韩在线视频一区 | 色天堂影院 | 99精品一区二区三区 | 国产精品黄视频 | 天天干成人网 | 久久国产精品偷 | 久久久久久免费毛片精品 | 亚洲精品福利在线 | 精品区| 精精国产xxxx视频在线野外 | 欧美性久久 | 国产99久久精品一区二区300 | 性视频一区 | 成人激情视频免费观看 | 日韩欧美国产一区二区三区 | 亚洲精品国产一区 | 久久爱一区| 亚洲在线日韩 | 一级片片 | 日韩在线国产 | 国产精品99久久久久久久vr | 精品久久久久久亚洲综合网 | 亚洲精品二区 | 青青草中文字幕 | 日本黄色免费片 | 久久aⅴ乱码一区二区三区 亚洲国产成人精品久久久国产成人一区 | 91福利在线观看视频 |