简体   繁体   English

在用户位于Android中我的位置时通知

[英]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.

相关问题 自动通知用户有关位置更新的信息 - Notify user about location updates automatically android Android:当应用程序未运行时如何通知用户 - Android : How to notify the user when the Application is not running 当 android 中的 Internet 连接丢失时通知用户 - Notify user when Internet connection is lost in android 用户启用位置服务后如何获得通知 - How to get notify when user has enabled Location services 如何安排3个事件通过android中的(通知栏)通知用户,即使我的应用未运行,该事件也会运行 - How to schedule 3 events to notify user via (notification bar) in android which runs even when my app is not running 仅当我的应用在Android中未处于活动/前台状态时,才从IntentService通知用户 - Notify user from IntentService only if my app is not active/foreground in Android 用户到达某个位置时通知他们 - Notify users when they reach a location android:当用户启用或禁用“我的位置”设置位置服务时如何引起注意 - android :how to get noticed when the My Location setting location service is enabled or disabled by user 当服务器中的数据更改时,android通知用户 - android notify User on when his data changes in the server 如何在Android进入电影院时通知用户? - How to notify user when he entered into a Movie theater in android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM