简体   繁体   中英

Mock Locations on Android 12

I am testing an app that uses geofencing and I need to be able to specify mock locations. In my research I found old posts (5 years) talking about using Allow Mock Locations in developer options but that seems to only be in older versions of Android. Now I see a place to specify a mock location app but no way to specify one. I looked at code samples to create a mock location app but the permission that has to be set (ACCESS_MOCK_LOCATION) appears to be only valid for system apps. Is there no way to do this anymore without rooting?

Firstly, the apps that acquire ACCESS_MOCK_LOCATION appear in developer options, which means you will be able to select your app as a mock location app when you add-in manifest

Secondly, ACCESS_MOCK_LOCATION is not a system app permission. So there is no need for rooting the device or marking your app as a system app etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM