Clear fused location provider's location for testing

后端 未结 2 1911
抹茶落季
抹茶落季 2021-01-22 08:09

I would like to know if it is possible to clear the \"location\" that is stored by play service\'s fused location API. When testing my app on a real device, I would like to recr

相关标签:
2条回答
  • 2021-01-22 08:50

    Google Play Services is central service and serves every app installed on your device. After clearing cache and data, if any app connects with Google Play services on that device(which almost every Google app do), then Fused location api will fetch and save location for that app. After that once your app fetches last known location in onConnected, it will return the location.

    It is hard to simulate the scenario your are trying to achieve unless you hard code the values to be blank.

    0 讨论(0)
  • 2021-01-22 09:04

    I just disabled the GPS then restarted the Android phone & I found that the locationManager.getLastKnownLocation returned NULL for location.

    0 讨论(0)
提交回复
热议问题