服务器上保存的位置的接近警报 [英] Proximity alert for locations saved at server

查看:67
本文介绍了服务器上保存的位置的接近警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我进行了一些搜索,但是找不到合适的答案.

I did some search but could not find a suitable answer.

我的应用"应与多个位置进行比较以取得接近度.这意味着我将无法使用locationManager将所有位置保存到我的应用中以确认附近位置.我希望在服务器中完成邻近确认

My App should compare with multiple locations for proximity. This means I will not be able to save all the locations into my app to confirm the proximity using locationManager. I want the proximity confirmation to be done in the server

实现此目标的最佳方法是什么?

What would be the best way to implement this?

如果每次设备四处移动时,应用都要求进行邻近确认,这会明智吗?

Would it be sensible if the app asks for proximity confirmation every time the devices moves around?

推荐答案

我会尝试另一种方法,因为每秒从GPS进行一次位置更新, 如果您有大量设备,我不建议每秒询问服务器是否接近.
想到这个主意-

I would try a different approach, since location updates from GPS are made once per second, and I don't think it's a good idea to ask the server each second for proximity if you have a large amount of devices.
Think of this idea -

  1. 获取设备的初始位置并将其发送到服务器.
  2. 确定一个合理的半径,使设备在接下来的5-10分钟内停留在该半径内. 另外,请确保您在该半径中没有太多"的点,或者在这种情况下可以缩小半径. 由您决定使用的半径和点数,具体取决于您的用法, 点数等.
  3. 将服务器在该半径范围内的所有位置从服务器发送到设备.
  4. 让设备自行计算距离.
  5. 当设备移出初始半径时-更新服务器并获取新的 相关位置. 这可以轻松完成-调用半径r.保存设备的初始位置,然后计算距离 在当前位置和初始位置之间.如果距离r足够近,请更新服务器.
  1. Get the device's initial location and send it to the server.
  2. Decide on a sensible radius that the device will stay within it for the next 5-10 minutes. Also make sure that you don't have "too many" points in that radius, or you can narrow the radius in that case. It's up to you to decide the radius and the number of points, depending on your usage, number of points etc.
  3. Send form the server all the locations within that radius to the device.
  4. Let the device calculate the proximity by itself.
  5. When the device moves out of the initial radius - update the server and get the new relevant locations. This can be done easily - call the radius r. Save the initial location of the device, and calculate the distance between the current and initail location. When it is "close enough" to r - update the server.

这篇关于服务器上保存的位置的接近警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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