简体   繁体   English

跟踪用户在后台的GPS位置,并通知他是否在某个点附近

[英]Track users GPS location in the background and notify if he is next to a certain point

I have a theoretical question. 我有一个理论上的问题。 I want to track a user with my app (iOS and Android) in order to notify him at a given time (11:45am) and just if he is next to a specific location (with lat/lng) even when the app is not open . 我想为了在给定时间(上午11:45),通知他来跟踪我的应用程序(iOS和Android)用户, 只是如果他是旁边的一个特定位置(与纬度/经度), 即使该应用程序是不是打开

Is it better to check the users location every 5 minutes when the device tracks a 500m change, and make a request to the server (if the time is right, and if the location is right), and then send out a push notification (when location and time is right)? 当设备跟踪500m的变化时,最好每5分钟检查一次用户的位置,并向服务器发出请求(如果时间合适,位置正确),然后发出推送通知(何时位置和时间对吗? Or should I send out a transparent push notification (without a visual notification) in order to wake up the app and to check the current location of the user? 还是我应该发出透明的推送通知(没有可视通知)以唤醒应用程序并检查用户的当前位置? Is this a common practice? 这是常见的做法吗?

EDIT I think the question is not as clear as I thought it will be, so I want to be more precise: I want to notify my user (iOS and Android) if they are at a specific location (specified with lat/lng) at a given time (eg: 11:00am), even when the app is closed. 编辑我认为问题并不像我想的那么清楚,所以我想更精确:我想通知用户(iOS和Android)是否位于特定位置(用lat / lng指定)给定的时间(例如:上午11:00),即使应用已关闭。

How can I do that? 我怎样才能做到这一点?

Your 500m requirement is inbetween GPS and cell tower. 您的500m要求介于GPS和手机信号塔之间。

cell tower locationing has about 1000m acuracy in cities and up to 3km in rural regions, this location technique is used in geofencing and the ios auto-wakeup (your "when the app is not open") is used. 在城市中,手机信号塔定位的精度约为1000m,而在农村地区则可达3km,此定位技术用于地理围栏,并使用ios自动唤醒(即“您的应用未打开时”)。 This does not need much battery. 这不需要太多电池。

GPS has about 3-20m, accuracy and uses more battery. GPS具有约3-20m的精度,并消耗更多电池。 battery consumption does not change wheter you check every second, or let the APi call you every 100m. 每秒检查一次,或让APi每100m打电话给您,电池消耗不会改变。 Some highest acuracy mode ios (mode best_for navigation), addionally enable acceleration sensor, whigh might need a bit more power then. 一些最高精度的ios模式(best_for导航模式),另外启用了加速度传感器,whigh可能需要更多的功率。 (This mode, you dont need) (此模式,您不需要)

(In cities also the Wlan location technique may provide a location probbaly meeting your req.) (在城市中,Wlan定位技术也可以提供可能满足您要求的定位。)

So you have the choice between 1000m low battery or 5m high battery consumption. 因此,您可以在1000m低电量或5m高电量消耗之间进行选择。 There is nothing inbetween (besides sometimes WLAN). 两者之间没有任何关系(有时甚至是WLAN)。

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

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