I am working on automating some device/server testing we do on various android devices. I need a way to set a specific GPS lat/long on an actual Android device that is usable within a NUnit testing framework. Any help on this will be appreciated.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You need to set Allow mock locations true under Developer settings. After that you can write some small utility app which will set mock location on receiving some custom event.
You can then set location using adb shell command e.g
$ adb shell am start -a android.intent.action.SET_CUSTOM_MOCK_LOCATION -d gps://lat-long
You can receive this information in your utility app and set mock location. Hope this helps