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