由于我将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上测试了一些其他已安装的应用程序,例如Googles MyTracks,并且它正常运行。 所以我真的不知道为什么这个问题只出现在我的应用程序只在HTC Desire HD上。
感谢您的阅读和帮助!
祝你好运, 麦克