在Android设备上设置一个模拟的GPS位置 [英] Set a mock GPS location on an Android device

查看:514
本文介绍了在Android设备上设置一个模拟的GPS位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的自动化,我们在各种Android设备的一些设备/服务器测试。我需要一种方法来设置一个特定的GPS纬度/经度实际的Android设备,一个NUnit的测试框架内是有用的。任何帮助将不胜感激。

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.

推荐答案

您需要设置允许模拟地点在开发人员设置真实。之后,你可以写一些小工具,应用程序,它会在收到某些自定义事件设置模拟位置。

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.

您可以用ADB命令,
如<然后设置位置/ p>

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

这篇关于在Android设备上设置一个模拟的GPS位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆