Android 手机上的欺骗或虚假位置
我几天来一直试图让它发挥作用,但没有成功。基本上,我正在编写一个小型测试应用程序,以使手机使用 addTestProvider 和 setTestProviderLocation 等报告其位置与其他地方相同。基本上,它看起来不错,并且似乎报告其位置已更改,但是 Google 地图等似乎仍在查询真正的GPS提供商。有谁知道如何解决这个问题?
这并不是一个真正有什么用途的应用程序,它只是为了满足我自己的好奇心和获得理解。
提前致谢。
I've been trying to get this to work for a few days without success. Basically, I'm writing a small test app to make the phone report it's position as somewhere else using addTestProvider and setTestProviderLocation etc. Basically it looks fine and appears to report its location as having changed, however Google Maps etc. seems to still be querying the real GPS provider. Does anyone have any ideas how to get around this?
This isn't an app that will actually be used for anything, it's just really to satisfy my own curiosity and gain an understanding.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要首先通过将以下内容添加到清单 xml 来允许您的应用程序使用模拟位置:
在您的手机上,通过选择“设置 -> ”下的“允许模拟位置”选项来确保启用“模拟位置”。应用->开发菜单。
然后使用模拟位置提供程序提供虚假位置(例如,通过从文件/数据库读取数据)
或者您可以远程登录到您的手机并模拟位置(同样,您需要在手机上启用许可和模拟位置):
You need to first allow your application to use Mock locations by adding the following to the manifest xml:
On your phone, ensure 'Mock Locations' are enabled by selecting the “Allow mock locations” option under the
Settings -> Applications -> Development
menu.And then use a mock location provider to give fake locations (e.g. by reading data off a file/db)
Alternatively you can telnet into your phone and mock the location (again you need permission and mock locations enabled on your phone):