androidfusedlocationproviderapi

Clear fused location provider's location for testing


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 recreate few scenarios and that's the reason I would like to know if this is possible.

I tried to clear "Google Play Services" cache and data. But, it does not seem to help me. Location still seems to be cached somewhere.


Solution

  • 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.