Android 手机上的欺骗或虚假位置

发布于 2024-09-12 11:40:16 字数 239 浏览 3 评论 0原文

我几天来一直试图让它发挥作用,但没有成功。基本上,我正在编写一个小型测试应用程序,以使手机使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

汐鸠 2024-09-19 11:40:16

您需要首先通过将以下内容添加到清单 xml 来允许您的应用程序使用模拟位置:

<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>

在您的手机上,通过选择“设置 -> ”下的“允许模拟位置”选项来确保启用“模拟位置”。应用->开发菜单。

然后使用模拟位置提供程序提供虚假位置(例如,通过从文件/数据库读取数据)

或者您可以远程登录到您的手机并模拟位置(同样,您需要在手机上启用许可和模拟位置):

$ telnet localhost 5554
Android Console: type 'help' for a list of commands
OK
geo fix -82.411629 28.054553
OK

You need to first allow your application to use Mock locations by adding the following to the manifest xml:

<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>

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):

$ telnet localhost 5554
Android Console: type 'help' for a list of commands
OK
geo fix -82.411629 28.054553
OK
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文