4

In my android app i ve map view and current location,nearest theaters displayed now i want to notify user when he entered into a theater(like geofence) i searched on NET and dint find any Android api which supports Geofencing please help how to do it?

Note:I tried http://geofence.locationlabs.com/ but not working means API keys are not comig. any example code really helpful Thanks in advance

P Srinivas Goud
  • 886
  • 1
  • 12
  • 30

1 Answers1

6

Hey I found the solution Try This,

We have to implement PendingIntent & Location Manager. Location Manager obtain the current Location of user and when user entered in some region it will fire a pending intent some code snippet as follow:

//---use the LocationManager class to obtain locations data---
lm = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
//---PendingIntent to launch activity if the user is within some locations---
PendingIntent pendIntent = PendingIntent.getActivity(
this, 0, new
Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://www.amazon.com")), 0);
lm.addProximityAlert(37.422006, -122.084095, 5, -1, pendIntent);

addProximityAlert method in which we can set the region (Radius for the User tracking) here is the more detail of addProximityAlert method.

Krishnakant Dalal
  • 3,568
  • 7
  • 34
  • 62
  • @PSrinivasgoud: I am also trying the same concept. I am a blackberry developer. I am literally new to android. Can you explain me little more about this or can you provide me any code sample on this ?? – Arun Kumar Munusamy May 17 '12 at 13:26
  • @ArunKumarMunusamy refer this link:http://www.javacodegeeks.com/2011/01/android-proximity-alerts-tutorial.html – P Srinivas Goud May 18 '12 at 05:38