Android geofence trigger activity -
i want start activity when person enters/exits geofence(email/sms app,contacts app etc).
is possible?
if possible, documentation suggests following
the intent sent location services can trigger various actions in app, should not have start activity or fragment, because components should become visible in response user action. in many cases, intentservice way handle intent.
can consider entering geofence user action?
please help me on this
intent intent = new intent("alert"); pendingintent proximityintent = pendingintent.getbroadcast(this, 0, intent, 0); locationmanager.addproximityalert(latitude, longitude, proximity_distance, -1, proximityintent);
then register receiver extends broadcastreceiver
intentfilter filter = new intentfilter("alert"); registerreceiver(<your receiver>, filter);
there can thing in onreceive method
if (intent != null) { string key = locationmanager.key_proximity_entering; boolean entering = intent.getbooleanextra(key, false); if (entering) { // whatever } }
android android-geofence
No comments:
Post a Comment