开发者

Assistance data injection into GPS

开发者 https://www.devze.com 2023-03-08 18:40 出处:网络
I am trying to develop an application which uses GPS and I would like to inject XTRA data and timereference to the GPS in order to get a faster fix. My code is the following one:

I am trying to develop an application which uses GPS and I would like to inject XTRA data and time reference to the GPS in order to get a faster fix. My code is the following one:

Bundle bundle = new Bundle();
boolean xtraInjection=locationmanager.sendExtraCommand(LocationManager.GPS_PROVIDER,"force_xtra_inje开发者_JAVA百科ction",bundle);
boolean timeInjection=locationmanager.sendExtraCommand(LocationManager.GPS_PROVIDER,"force_time_injection",bundle);

No matter whether internet connection is on or off (no cellular neither wifi) the xtraInjection and timeInjection booleans are always true. So, I not able to detect if the assistance information is well injected into the GPS.

When the wifi connection is enabled, the next log message appears (no error message if wifi is down):

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

In contrast, there is no log message related with XTRA data. If the XTRA data is still valid, the system does not request for it? How can I see if it is injected successfully?

To make these tests I have also tried deleting assistance data but I know that this is not well done:

My code:

boolean reset=locationmanager.sendExtraCommand(LocationManager.GPS_PROVIDER, "delete_aiding_data", null);

log:

I/app (  627): reset:false
D/lib_locapi(   96): loc_eng_ioctl for aiding data deletion returned 0, 1 for success

I have also tried with GPS STATUS application and the results are the same for both, inject and delete.

In short, I do not know whether the problem is in my code or is something in the driver implementation. There is any way to obtain more information about these problems apart from logcat? (I can not root my device).

Thank you in advance


If you look at frameworks/base/services/java/com/android/server/location/GpsLocationProvider.java, you'll find that these commands will always return true.

There is very little reason why you should be doing this, and a few reasons why you shouldn't:

  • Android will automatically inject time and XTRA data when the network first comes up after booting. Time should not need to be re-injected as the GPS chip will synchronise its internal clock with GPS whenever it has a fix. The GPS chip will automatically request new XTRA data when needed.
  • XTRA is only applicable to the Qualcomm GPS chipset. The other vendors do have equivalent services but these are not exposed in GpsLocationProvider like XTRA is.
  • Chances are that an Internet connection will be available. In this case, the GPS will just download ephemerides from the SUPL server when needed, only falling back to XTRA when this is not possible.
0

精彩评论

暂无评论...
验证码 换一张
取 消