Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an ADB command to toggle Allow Mock Locations?

Tags:

android

adb

I've searched through some topics but haven't found an answer. I need not to specify lat/long but turn the switch of allowing mock locations.

like image 637
Quinteger Avatar asked Mar 31 '16 17:03

Quinteger


1 Answers

In Marshmallow (and above) after you have installed your app, just run:

adb shell appops set com.example.my.package android:mock_location allow

hope this helps!

Some internals: the string android:mock_location is resolved by the AppOpsManager into an actual int and than executed.

like image 91
Francesco Pez Avatar answered Oct 13 '22 16:10

Francesco Pez