当接近警报触发时,我正在使用以下代码来确定当前位置:
Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (location == null) {
location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
if (location == null) {
// We'll just write an empty location
location = new Location("");
}
}
当我查看返回的位置时,我会在不应该收到警报的位置输入警报。我的印象是接近警报在内部轮询 GPS 和网络提供商 - 从而更新 LastKnownLocation - 此代码将产生当前位置。这个假设正确吗?