Test provider for mock location not working on Android 10
This is not really coming from the mocking, but the LocationManager
's .addTestProvider()
. Adding the same one test-provider twice will in every case not work out, according to the source code. For later API levels, just use .setTestProviderLocation(String provider, Location loc)
instead of trying to add that mocked provider with the duplicate name; or at least remove the existing one, before trying to add another one with the same name.