我观察了三星Galaxy S3和HTC One M8上的代码和GPS图标。发现GPS被禁用了。
mLocationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000 * 10, 0, this, Looper.myLooper());
...
@Override
public void onLocationChanged(Location location) {
mListenerRef.get().onLocationChanged(location);
}
Galaxy s3 - GPS图标没有出现,onLocationChanged方法也没有触发。(没关系)
Htc one m8 - GPS图标出现、闪烁并且触发了onLocationChanged。(但是怎么实现的?)
此时会有疑问:
- ACCESS_FINE_LOCATION权限是否允许应用程序在某些设备上覆盖GPS状态?
- 因此,即使关闭了GPS,应用程序是否仍能接收位置?
然后我在Galaxy s3上启用了GPS
(前2分钟)GPS图标出现(但不闪烁),onLocationChanged方法被触发(但是怎么实现的?)
(2分钟后)GPS图标出现(闪烁),onLocationChanged方法被触发
又会产生疑问:
- GPS图标的闪烁是什么意思?有其他特殊含义吗?
- 闪烁表示GPS硬件正在尝试第一次修复吗?
- 还是闪烁表示提供者正在触发onLocationChanged方法?