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_injection",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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With