7
我的應用必須持續跟蹤用戶。爲此,我有一個LocationListener
應該不斷地接收位置更新。問題是屏幕關閉時,它沒有收到任何更新。Android屏幕鎖定時未收到位置更新信息
我已經嘗試添加一個局部喚醒鎖:
mLocationRequest = LocationRequest.create();
mLocationRequest.setInterval(LocationUtils.UPDATE_INTERVAL_IN_MILLISECONDS);
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
mLocationRequest.setFastestInterval(LocationUtils.FAST_INTERVAL_CEILING_IN_MILLISECONDS);
mLocationClient = new LocationClient(ADS.getAppContext(), new LocationGatherer(), new LocationGatherer());
mLocationClient.connect();
PowerManager pm = (PowerManager) ADS.getAppContext().getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
wl.acquire();
但它仍然沒有收到更新。
看一看[這裏](http://stackoverflow.com/a/14478281/312312)它應該會幫助你 – Lefteris