简体   繁体   中英

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.

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 ?

Thanks!

Instead ProximityAlert I would use Geofences.

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. 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.

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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