Is there an ADB command to toggle Allow Mock Locat

2020-07-15 15:19发布

问题:

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.

回答1:

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.



标签: android adb