Android: How to reset and download A-GPS data?

后端 未结 2 862
旧巷少年郎
旧巷少年郎 2020-12-13 11:19

How can I programmatically reset and download new A-GPS data in an Android application? In other words, how do the \"Manage A-GPS state\" tools work in the GPS Status &

2条回答
  •  [愿得一人]
    2020-12-13 12:09

    You should be able to use LocationManager.sendExtraCommand(String provider, String command, Bundle extras). This will allow you to delete all or part of the GPS data, so it will redownload it. The docs are here, but a quick rundown of the arguments, referenced from this code(for a GPS Provider):

    For provider, use LocationManager.GPS_PROVIDER.

    For command, use "delete_aiding_data"

    For extras, if you pass null, it will delete all data. If you want to delete specific data only(such as just the almanac or position), you can use the flags found in this function as extras in the bundle.

    Don't forget to add android.permission.ACCESS_LOCATION_EXTRA_COMMANDS to your permission list in the manifest!

提交回复
热议问题