Skip to content Skip to sidebar Skip to footer

Android: How To Check That Whether I Reach/near My Destination?

I am developing an application that wakeup to you when you reach/near your destination and send you notification like Alarm. Is it any way whether i check continuously user's curre

Solution 1:

You should create a geofence and add it to google location services it will notify you (callback) when a user enters in a particular geofence or exits it.

Follow this: http://developer.android.com/training/location/geofencing.html

Solution 2:

You'll need to implement LocationListener to get the location updates but mind you it can drain the device's battery like crazy. When you've got the current location, you can use distanceTo() method using the obtained location instance to calculate the distance from the destination provided you have the destination lat-long values. Now here you can check whether the value returned by distanceTo() method is within the acceptable range of being close to the destination for example.. acceptable range for me to reach the destination would be if the ditance between current location and destination is within 40 mtrs.

Post a Comment for "Android: How To Check That Whether I Reach/near My Destination?"