【发布时间】:2011-05-25 14:41:47
【问题描述】:
我正在尝试开发一个使用 GPS 的应用程序,我想向 GPS 注入 XTRA 数据和时间参考,以便更快地修复。我的代码如下:
Bundle bundle = new Bundle();
boolean xtraInjection=locationmanager.sendExtraCommand(LocationManager.GPS_PROVIDER,"force_xtra_injection",bundle);
boolean timeInjection=locationmanager.sendExtraCommand(LocationManager.GPS_PROVIDER,"force_time_injection",bundle);
无论互联网连接是打开还是关闭(没有蜂窝网络也没有 wifi),xtraInjection 和 timeInjection 布尔值始终为真。所以,我无法检测到援助信息是否良好 注入 GPS。
启用 wifi 连接后,会出现下一条日志消息(如果 wifi 关闭,则不会出现错误消息):
I/app ( 627): timeInjection:true
....
D/GpsLocationProvider( 96): NTP server returned: 1306322421969 (WedMay 25 13:20:21 GMT+02:00 2011) reference: 338139 certainty: 77 systemtime offset: 7162
D/lib_locapi( 96): loc_eng_inject_time, uncertainty = 77
相比之下,没有与 XTRA 数据相关的日志消息。如果 XTRA 数据仍然有效,系统不要求它吗?如何查看是否注入成功?
为了进行这些测试,我也尝试过删除辅助数据,但我知道这做得不好:
我的代码:
boolean reset=locationmanager.sendExtraCommand(LocationManager.GPS_PROVIDER, "delete_aiding_data", null);
日志:
I/app ( 627): reset:false
D/lib_locapi( 96): loc_eng_ioctl for aiding data deletion returned 0, 1 for success
我也尝试过使用 GPS STATUS 应用程序,注入和删除的结果都相同。
简而言之,我不知道问题出在我的代码中还是在驱动程序实现中。除了 logcat,还有什么方法可以获取有关这些问题的更多信息? (我无法 root 我的设备)。
提前谢谢你
【问题讨论】:
-
你找到解决办法了吗?
标签: android gps locationmanager supl