Android defineds a GPS device capability I couldn't find reference to It's defined as GPS_CAPABILITY_ON_DEMAND_TIME in gps.h The description in the comment explains: GPS on demand time injection. What does it mean ?

1 Answer 1


GPS_CAPABILITY_ON_DEMAND_TIME refers to the ability of the Android framework to trigger an injection of the current time into the GPS engine. This is used as part of the assistance data to speed up time-to-first-fix. Here's where the constant is used in the Android framework: https://github.com/android/platform_frameworks_base/blob/master/services/core/java/com/android/server/location/GpsLocationProvider.java#L1625

You can see what happens in the handleInjectNtpTime() method (NTP = "Network Time Protocol"): https://github.com/android/platform_frameworks_base/blob/master/services/core/java/com/android/server/location/GpsLocationProvider.java#L842

Apps can also trigger this via the LocationManager.sendExtraCommand("force_time_injection"); method - the app GPSTest has a button where you can trigger this time injection manually, if you want to hook up an Android device and trigger the call and see what happens (fully disclosure - GPSTest is my app). On some devices you can see LogCat output fetching the NTP time.

Here's the code in GPSTest that triggers the call to inject NTP time: https://github.com/barbeau/gpstest/blob/master/GPSTest/src/main/java/com/android/gpstest/GpsTestActivity.java#L173

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.