LocationManager:HTC Desire HD 上的 Gingerbread 更新后出现奇怪行为
自从我将 HTC Desire HD 更新为 Gingerbread(2.3.3,官方更新)后,LocationManager 不再正常工作。 Android 自带的 GPS 图标正在闪烁(正在搜索修复),找到修复后,该图标就会消失。几秒钟后,图标再次闪烁并再次消失...
奇怪的是,我没有更改代码中的任何内容,并且相同的代码在 HTC Desire 或 Nexus S 等其他设备上按预期工作
mLocationManager= (LocationManager)getSystemService(Context.LOCATION_SERVICE);
mLocationListener = new MyLocationListener();
// begin with requesting GPS
mLocationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 60000, 10, mLocationListener);
。功能在我的应用程序中启动,我通过 logcat 收到大量消息:
05-15 15:01:47.322: DEBUG/GpsLocationProvider(1344): addListener(org.myApp)
05-15 15:01:47.322: DEBUG/GpsLocationProvider(1344): setMinTime 60000
05-15 15:01:47.322: VERBOSE/GpsLocationProvider(1344): enableLocationTracking ++
05-15 15:01:47.322: DEBUG/GpsLocationProvider(1344): startNavigating
05-15 15:01:47.322: DEBUG/lib_locapi(1344): [GPS:] loc_eng_set_qos_time_out(standalone = 60000, agps = 89000)
05-15 15:01:47.322: VERBOSE/GpsLocationProvider(1344): set_agps_qos_time_out complete
05-15 15:01:47.322: DEBUG/GpsLocationProvider(1344): android_location_GpsLocationProvider_set_position_mode+
05-15 15:01:47.322: DEBUG/GpsLocationProvider(1344): GetGpsInterface+
05-15 15:01:47.322: DEBUG/GpsLocationProvider(1344): GetGpsInterface-
05-15 15:01:47.322: DEBUG/GpsLocationProvider(1344): android_location_GpsLocationProvider_set_position_mode- (get interface sucess)
05-15 15:01:47.322: DEBUG/lib_locapi(1344): [GPS:] loc_eng_set_position mode, client = 1, interval = 1000, mode = 1
05-15 15:01:47.322: VERBOSE/LocationManagerService(1344): requestLocationUpdates
05-15 15:01:47.332: DEBUG/lib_locapi(1344): [GPS:] loc_eng_set_position mode: GPS_POSITION_MODE_MS_BASED
05-15 15:01:47.332: DEBUG/lib_locapi(1344): [GPS:] loc_eng_set_position mode before IOCTL, interval=1000, mode =2 preferred_accuracy=50, qos_timeout_standalone=89000, recurrence_type=2
05-15 15:01:47.332: VERBOSE/lib_locapi(1344): loc_eng_ioctl called: client = 1, ioctl_type = 2
05-15 15:01:47.332: VERBOSE/locapi_rpc_glue(1344): loc_ioctl
05-15 15:01:47.332: DEBUG/RPC(1344): written RPC packet size: [96]
05-15 15:01:47.332: DEBUG/RPC(1344): read RPC packet
05-15 15:01:47.332: DEBUG/RPC(1344): read RPC packet size: [28]
我已经在 HTC Desire HD 上测试了一些其他已安装的应用程序,例如 Google 的 MyTracks,并且它工作正常。 所以我真的不知道为什么这个问题只出现在我的应用程序仅在 HTC Desire HD 上。
感谢您的阅读和帮助!
此致, 麦克风
Since I updated my HTC Desire HD to Gingerbread (2.3.3, official update) the LocationManager isn't working correctly anymore. The android-own gps icon is blinking (searching for a fix) and when a fix was founded, the icon disappears. After some seconds the icon is blinking again and disappears again...
The strange thing is that I didn't change anything on my code an that the same code is working as expected on other devices like HTC Desire or Nexus S.
mLocationManager= (LocationManager)getSystemService(Context.LOCATION_SERVICE);
mLocationListener = new MyLocationListener();
// begin with requesting GPS
mLocationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 60000, 10, mLocationListener);
When the location functions are started in my app, I get a huge amount of messages by logcat:
05-15 15:01:47.322: DEBUG/GpsLocationProvider(1344): addListener(org.myApp)
05-15 15:01:47.322: DEBUG/GpsLocationProvider(1344): setMinTime 60000
05-15 15:01:47.322: VERBOSE/GpsLocationProvider(1344): enableLocationTracking ++
05-15 15:01:47.322: DEBUG/GpsLocationProvider(1344): startNavigating
05-15 15:01:47.322: DEBUG/lib_locapi(1344): [GPS:] loc_eng_set_qos_time_out(standalone = 60000, agps = 89000)
05-15 15:01:47.322: VERBOSE/GpsLocationProvider(1344): set_agps_qos_time_out complete
05-15 15:01:47.322: DEBUG/GpsLocationProvider(1344): android_location_GpsLocationProvider_set_position_mode+
05-15 15:01:47.322: DEBUG/GpsLocationProvider(1344): GetGpsInterface+
05-15 15:01:47.322: DEBUG/GpsLocationProvider(1344): GetGpsInterface-
05-15 15:01:47.322: DEBUG/GpsLocationProvider(1344): android_location_GpsLocationProvider_set_position_mode- (get interface sucess)
05-15 15:01:47.322: DEBUG/lib_locapi(1344): [GPS:] loc_eng_set_position mode, client = 1, interval = 1000, mode = 1
05-15 15:01:47.322: VERBOSE/LocationManagerService(1344): requestLocationUpdates
05-15 15:01:47.332: DEBUG/lib_locapi(1344): [GPS:] loc_eng_set_position mode: GPS_POSITION_MODE_MS_BASED
05-15 15:01:47.332: DEBUG/lib_locapi(1344): [GPS:] loc_eng_set_position mode before IOCTL, interval=1000, mode =2 preferred_accuracy=50, qos_timeout_standalone=89000, recurrence_type=2
05-15 15:01:47.332: VERBOSE/lib_locapi(1344): loc_eng_ioctl called: client = 1, ioctl_type = 2
05-15 15:01:47.332: VERBOSE/locapi_rpc_glue(1344): loc_ioctl
05-15 15:01:47.332: DEBUG/RPC(1344): written RPC packet size: [96]
05-15 15:01:47.332: DEBUG/RPC(1344): read RPC packet
05-15 15:01:47.332: DEBUG/RPC(1344): read RPC packet size: [28]
I've tested some other installed apps on the HTC Desire HD like Googles MyTracks and there it is working correctly.
So I really don't know why this problem only appears with my app only on a HTC Desire HD.
Thank you for reading and your help!
Best regards,
Mike
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论