如何从服务器验证/信任 iOS 或 Android 设备的位置?
我正在编写服务器来支持 iOS 和 Android 的基于位置的应用程序。该应用程序要求我们验证用户的身份及其位置。我知道如何做前者,但不知道如何做后者。
是否可以验证客户端发送给我的纬度/经度实际上是设备对其当前位置的最佳估计?我担心恶意客户端会欺骗位置并欺骗系统。
澄清:我想知道服务器如何通过某种验证过程信任它发送的位置。
我可以弄清楚如何从设备获取用户的位置。例如,在 Android 平台上,我的应用程序将注册以接收 android.location.Location< /a>s,拉出纬度/经度,并将其发送到服务器。
但我怎样才能让服务器相信我不是编造的呢?从服务器的角度来看,当给定纬度/经度时,为什么它应该相信用户实际上在那里(或者在给定准确性的情况下接近那里)?
也许有某种方法可以对数据进行签名?
foursquare 和 Facebook 等应用程序的服务器如何验证所提供的位置数据不是伪造的?
I am writing the server to back a location-based app for iOS and Android. The app requires that we verify both the identity of the user and their location. I know how to do the former, but not the latter.
Is it possible to verify that the lat/lon the client is sending me is in fact the device's best estimate of the its current location? I'm worried about a malicious client spoofing a location and gaming the system.
CLARIFICATION: I would like to know how a server can trust, through some kind of verification process, the locations it is sent.
I can figure out how to get the user's location from the device. For example, on the Android platform my app would register to receive android.location.Locations, pull out the lat/lon, and send it to the server.
But how do I convince the server that I didn't just make it up? From the server's perspective, why should it believe, when given a lat/lon, that the user is actually there (or close to there given the accuracy)?
Perhaps there's some way of signing the data?
How do the servers for apps like foursquare and Facebook verify that the location data they're being given isn't being faked?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
编写您自己的 Android 或 iOS 客户端。因为我正在开发 Android,所以代码非常简单。您需要编写一项在给定时间段内运行的服务。该服务将获取位置。通过这种方式,您将确保您收到的纬度/经度仅由您的代码决定。现在下一点是准确性。您可以在 android 中使用 criteria 类。您可以定义自己的获取位置的标准。
Write your own android or iOS client. As I am working on android it is very simple code. You need to write one service which runs on given period of time. This service will fetch the location. By this you will be sure that what ever lat/long you are receiving is only by your code. Now next point is accuracy. You can use criteria class in android. You can define your own criteria for fetching location.
在 Android 和 iOS 中编写服务,定期将当前的纬度/经度发布到服务器。
并且还编写代码定期从服务器获取纬度/经度并将其操作到 Android 或 IOS 地图。
享受。 :))
Write service in Android and iOS that post the current lat/long periodicaly to the server.
And Also write code that fetch the lat/long periodicaly from the server and manipulate it to the Android or IOS map.
Enjoy. :))
据我所知,我不相信使用 Xcode 和 GPX 文件来模拟位置时可以检测到 iOS 上的位置欺骗。所有应用程序,甚至 iOS 地图应用程序都会相信您的位置是用于通过 Xcode 模拟您位置的 GPX 文件中设置的位置。
有关此方法的更多信息:http://www.neglectedpotial。 com/2013/04/spoofing-location-services-in-ios/
From what I can tell, I don't believe it's possible to detect location spoofing on iOS when done using Xcode and GPX files to simulate location. All apps, even the iOS Map's app will believe your location is whatever it is set in the GPX file used to simulate your location via Xcode.
More info on this method: http://www.neglectedpotential.com/2013/04/spoofing-location-services-in-ios/