I would like to set the "mock location app
" without any user intervention so I can partially automate some tests on Android 6.0.
geo fix
is not appropriate in my situation.
Is it possible?
Go to your “Settings”, “Systems”, “About Device” and tap multiple times on “Build number” and activate the Developer Mode. A new “Developer Options” menu will be available under “Settings” / “Systems” In the “Developer Options” menu, scroll down to “Debugging” and activate the “Allow mock locations”.
Open the 'Developer Options' menu and scroll to the bottom until you find 'Debugging'. Activate Mock Location by going to the 'Allow Mock Locations' option.
After you download the app, go to Settings > Developer options and tap on Mock location app. Tap on it and it'll show all the available mock location apps installed on your device. Choose one and you're good to go. You can use the apps to select a location of your choice.
For Android 6.0+:
Allowing app for mock locaiton
adb shell appops set <PACKAGE> android:mock_location allow
Removing app for mock location
adb shell appops set <PACKAGE> android:mock_location deny
Checking if app is set for mock location
adb shell appops get <PACKAGE> android:mock_location
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With