[英]Notify when user is in my location in Android
I am looking for an easy way to check if a user is at my location (50m) radius if notify me. 如果要通知我,我正在寻找一种简单的方法来检查用户是否在我的位置(50m)半径内。
Right now I have a service running every two minutes getting position of each user comparing it and then notifying if user in same location. 现在,我每两分钟运行一次服务,获取每个用户的位置进行比较,然后通知用户是否在同一位置。
Can this be done using promixityalert: http://goo.gl/9I857T ? 可以使用promixityalert: http : //goo.gl/9I857T吗?
Thanks! 谢谢!
Instead ProximityAlert I would use Geofences. 取而代之的是ProximityAlert,我将使用地理围栏。
http://developer.android.com/training/location/geofencing.html http://developer.android.com/training/location/geofencing.html
Is newer and does a more effective use of the battery 较新并且可以更有效地使用电池
In your case, you can have a service that sends to the other device the current location every X minutes, so it can update the Geofence. 在您的情况下,您可以使用一项服务,该服务每隔X分钟将当前位置发送到另一台设备,从而可以更新Geofence。 The problem that I see is that there would be a lot of calls, spending battery and the data plan. 我看到的问题是,将会有大量的通话,电量消耗和数据计划。
A good approach is to use the Location Services API, you can detect if a user is standing or moving. 一个好的方法是使用Location Services API,您可以检测用户是站立还是移动。
http://developer.android.com/training/location/activity-recognition.html http://developer.android.com/training/location/activity-recognition.html
Using this and sending new locations only when the user is moving you will be able to reduce the amount of calls. 仅在用户移动时使用此功能并发送新位置,您将能够减少通话量。
Parse is another option as @thepace mention. 解析是@thepace提及的另一种选择。 It is easy to use and whit it would be easy to implement what you are trying to do, but is not free :( 它很容易使用,也很容易实现您想做的事情,但是它不是免费的:(
Hope it helps. 希望能帮助到你。
Issue: Check if any user (multiple and variable location) is within specific radius of my current location(variable).
Solution:
1. Parse.com
a) Ensure every user has their location updated in Parse DB including yours.
https://parse.com/tutorials/anywall-android
b) Use push notificaitons: https://parse.com/docs/push_guide#setup/Android
1> Create a channel wherein only you are subscribed.
2> Create your installation query and send notification to it to the channel subscribed.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.