Phunction
Phunction

Reputation: 121

Changes in Android 11, no longer able to provide mock location

I have an app that provides mock locations, works fine up to Android 10, however on Android 11 it no longer works, I just get the error "Error while pushing mock location gps provider is not a test provider" I searched the docs but I can't find any info on what may be causing the error. Is this a permission issue? I am not sure what changed, the APK works fine on Android 10 and less but not 11.

Upvotes: 0

Views: 5694

Answers (2)

Varun RTR
Varun RTR

Reputation: 29

After lot of study I found below helpful solution helpful. Actually error itself stated that

powerRequirement is out of range of [1, 3] (too low)

While adding your test provider you can assign power requirements from 0 to 1.

locationManager.addTestProvider(this._provider, false, false, false, false, true, true, true, **1**, 1);

Upvotes: 0

Phunction
Phunction

Reputation: 121

In case anyone else comes across this, when adding the provider to the location manager, I could no longer specify a power of 'no requirement' or an accuracy of 'high'. I had to specify low power and medium accuracy. I understand the power one but not sure why accuracy high would not be allowed for android 11.

Upvotes: 2

Related Questions