我需要每分钟获取GPS位置更新(电池寿命不是问题,因为设备将在车内充电)。这是一个公司交付应用程序,与车辆跟踪,与谷歌地图结合使用,以跟踪送货计划人员的旅程等。一致的GPS更新 - AlarmManager或requestLocationUpdates()?
我已经使用AlarmManager和LocationManager.requestLocationUpdates()与监听器。后者看起来有些rope and,依靠文档,它可能会或可能不会提供位置。但我已经看到,尽管minTime设置为1分钟,距离为0/1,但我仍然只看到每5分钟更新一次或两次。
private void startGeoLocationSender()
{
LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
LocationListener locationListener = new GeoLocationListener(this);
// MINIMUM TIME TO REQUEST , MIN DISTANCE TO REQUEST, LISTENER
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
AppSettings.COLLECTOR_PROC_1_MINS,
AppSettings.COLLECTOR_DISTANCE_1_M, locationListener);
}
那么,是不是值得我只是要回到一个AlarmManager和手动强制更新它是可靠的?还是有另一种方法,在特定的更新时间内100%可靠?什么更适合我的要求?
PS。我非常了解这个主题的其他几千个主题,但我从来没有见过这样一个好的Vs Evil趋势。一些民众发誓由位置听众,和其他人只AlarmManagers。