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

<tfoot id='rKSuj'></tfoot>

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

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

      使用 LocationClient 定期獲取更新最省電的方法是什

      What#39;s the most battery-efficient approach of using LocationClient to periodically get updates?(使用 LocationClient 定期獲取更新最省電的方法是什么?)
        <i id='zdBDG'><tr id='zdBDG'><dt id='zdBDG'><q id='zdBDG'><span id='zdBDG'><b id='zdBDG'><form id='zdBDG'><ins id='zdBDG'></ins><ul id='zdBDG'></ul><sub id='zdBDG'></sub></form><legend id='zdBDG'></legend><bdo id='zdBDG'><pre id='zdBDG'><center id='zdBDG'></center></pre></bdo></b><th id='zdBDG'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='zdBDG'><tfoot id='zdBDG'></tfoot><dl id='zdBDG'><fieldset id='zdBDG'></fieldset></dl></div>
            <tbody id='zdBDG'></tbody>

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

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

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

                本文介紹了使用 LocationClient 定期獲取更新最省電的方法是什么?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我正在考慮設置兩個單獨的警報來每小時收集用戶的位置數據,一個每 59 分鐘觸發一次以連接"客戶端,另一個用于實際獲取位置,然后斷開客戶端.

                I am thinking about having two separate alarms to gather a user's location data every hour, one that goes off every 59 minutes to "connect" the client and a second to actually get the location and then subsequently disconnect the client.

                在電池壽命方面,如果獲取用戶的位置將成為應用程序的主要消耗,我還應該考慮做些什么?或者,是否有不同的方法來設置兩個警報?我最初只有一個警報,但執行 (!mLocationClient.isConnected) 然后進行連接檢查并沒有給客戶端足夠的時間來連接.

                In terms of battery life, is there anything else I should consider doing if getting the user's location will be the primary drain of the app? Or, is there a different approach to having two alarms? I originally only had a single alarm, but performing a (!mLocationClient.isConnected) then connect check does not give the client enough time to connect.

                感謝您的洞察力.

                兩個警報會像這樣響起:

                The two alarms would go off something like this:

                private int PERIODIC_UPDATE = 60000*60;  //gets location and disconnects every hour
                private int PERIODIC_RECONNECTION_UPDATE = 60000*59;  //connects 1 minute before getLocation call
                
                    Timer toReconnect = new Timer();
                    toReconnect.schedule(new TimerTask() {
                
                        @Override
                        public void run() {
                            mLocationClient.connect();
                        }
                    }, 5000, PERIODIC_RECONNECTION_UPDATE);
                
                    Timer theTimer = new Timer(); 
                    theTimer.schedule(new TimerTask(){
                        @Override
                        public void run() {
                            try {
                                if(!mLocationClient.isConnected()) {
                                    mLocationClient.connect();
                                    //This will not have much affect because cannot so quickly, will remove. 
                                }
                
                                Location theLocation = mLocationClient.getLastLocation();
                                if(theLocation!=null) {
                                    checkPostLocation(theLocation); 
                
                                    mLocationClient.disconnect();
                                }
                            } catch (Exception e) {
                                e.printStackTrace();
                            }   
                        }}, 5000, PERIODIC_UPDATE);
                

                推薦答案

                你真的需要跟蹤用戶嗎?

                Do you actually need to track the user?

                如果只是關于 UI,則使用 getLastKnownLocation(PASSIVE_PROVIDER),假設他們在其他地方使用手機上的定位服務,您應該會得到一些半準確的信息.

                If it's just about UI, then use getLastKnownLocation(PASSIVE_PROVIDER) and you should get something semi-accurate assuming they used location services on their phone somewhere else.

                如果您需要實際對用戶進行三角測量,請實現不同的供應商使用不同的電池.被動<網絡<全球定位系統.

                If you need to actually triangulate the user, realize the different providers use different battery. Passive < Network < GPS.

                定位用戶越多,GPS 消耗的電量和時間就越多.

                The more you locate the user, the more battery with GPS taking the most battery and time.

                按計劃啟動服務,1 小時或其他任何時間,只需要一項服務.最多只能活 1 分鐘(或更短),收聽所有位置提供商.在分鐘或準確度足夠好后,您保存結果并關閉服務.

                Start the service by intent one a schedule, 1 hour or whatever, only one service necessary. Only live for a maximum of 1 minute (or less), listen on all Location providers. After the minute or accuracy is good enough, you save the result and shut down the service.

                這篇關于使用 LocationClient 定期獲取更新最省電的方法是什么?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 或網絡提供商)

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

                        <legend id='ZDMwH'><style id='ZDMwH'><dir id='ZDMwH'><q id='ZDMwH'></q></dir></style></legend>
                        • <bdo id='ZDMwH'></bdo><ul id='ZDMwH'></ul>
                        • <small id='ZDMwH'></small><noframes id='ZDMwH'>

                          主站蜘蛛池模板: 国产成人精品一区 | 亚洲精品一区中文字幕 | 日韩一区二区精品 | 草b视频| 九九视频在线观看视频6 | 天堂免费看片 | 日本精品一区二区三区视频 | 黄色欧美大片 | 日韩二区 | 韩国精品在线观看 | 午夜日韩视频 | 91黄色免费看 | 毛片国产| 亚洲网在线 | 91精品国产综合久久久动漫日韩 | 日本久久福利 | 欧美一区二区另类 | 国产精品免费一区二区三区四区 | 美女久久| 亚洲精品久久久久中文字幕欢迎你 | 欧美精品久久久久久久久老牛影院 | 免费看淫片 | 欧美在线观看一区 | 国产精品久久久久久久一区二区 | 人人爽人人爽人人片av | 亚洲精品视频在线看 | 色婷婷综合成人av | 国产精品高潮呻吟 | 99re视频在线 | 欧美性影院 | 国产精品a一区二区三区网址 | 三区四区在线观看 | 久久久久久国产精品 | 成人免费视频网站在线观看 | 欧美午夜视频 | 亚洲国产成人在线 | 91在线精品播放 | 欧美一区二区三区在线观看 | 国产免费一区二区 | 网色 | 精品二 |