简体   繁体   English

从iPhone发送实时位置数据到服务器的最佳做法

[英]Best practice for sending live location data to server from iPhone

I want to develop an application for the iphone, that tracks the current position of the user in "realtime" and sends this data to a sql database on a webserver by a web service, so I will be able to have a consistent database where the registered users a currently positioned. 我想开发一个iphone应用程序,用于“实时”跟踪用户的当前位置,并通过Web服务将此数据发送到Web服务器上的sql数据库,这样我就可以拥有一个一致的数据库。注册用户当前定位。

This is raising some questions on how to do this in an efficient way. 这提出了一些有关如何以有效方式执行此操作的问题。

1) Shall I really update the GPS data in realtime on the server? 1)我真的应该在服务器上实时更新GPS数据吗? Isn't this to "heavy" regarding energy consumption on the iphone? 关于iPhone的能耗,这不是“重”吗? Maybe once a minute does it as well? 也许一分钟一次呢? What are best practices here when I want to be as accurate as possible? 当我想尽可能准确时,最佳做法是什么?

2) What if there a maybe 1000 users at once.... is this still efficient to update a database with the current GPS data simultaneously? 2)如果一次可能有1000个用户怎么办?用同时更新当前GPS数据的数据库仍然有效吗?

Thank you in advance Sebastian 提前谢谢塞巴斯蒂安

Sending GPS data at regular time intervals will put extra load on the system unnecessarily and it is not optimal. 以固定的时间间隔发送GPS数据将不必要地给系统带来额外的负荷,并且它不是最佳的。

A better way to track the user is to send data only when the user has moved outside a circle of radius R from the last reported location. 跟踪用户的更好方法是仅在用户移动到距离上次报告的位置的半径为R的圆圈之外时才发送数据。

That way a user moving in a car at 60 mph on a highway and one walking at 0.1 mph in a park will both be tracked accurately. 这样,用户在高速公路上以60英里/小时的速度在汽车中行驶,并且在公园中以0.1英里/小时的速度行走,将被准确地跟踪。

Users are known to stop moving when they sit down to eat, go to the bathroom or sleep. 众所周知,当用户坐下来吃饭,去洗手间或睡觉时,他们会停止移动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM