not getting any notification in fencing using android -
i trying run sample of fencing in android. showing fence radius of 2 meter on google map , @ same time showing current location 2 meter radius.
as can see in below image current location ( in green ) far fence ( in red ) still neither geofence.geofence_transition_exit
nor intentservice
not getting called.
even when entered fence nothing gets notified.
i have seen other threads nothing getting worked.
here basic settings
<service android:name=".geofencetransitionsintentservice" android:exported="false" > </service>
pending intent
private pendingintent getgeofencetransitionpendingintent() { intent intent = new intent(this, geofencetransitionsintentservice.class); return pendingintent.getservice(this, 0, intent, pendingintent.flag_update_current); }
inside onconnected
mgeofencerequestintent = getgeofencetransitionpendingintent(); locationservices.geofencingapi.addgeofences(mapiclient, mgeofencelist, mgeofencerequestintent);
i tried broadcastreceiver no luck
private pendingintent getmgeofencetransitionpendingintentreceiver(){ if(mgeofencerequestintent!=null){ return mgeofencerequestintent; }else{ intent intent = new intent(geofence_receiver); return pendingintent.getbroadcast(this, 0, intent, pendingintent.flag_update_current); } }
inside manifest file
<receiver android:name=".geofencereceiver" android:exported="false"> <intent-filter> <action android:name="com.geofence.georeceiver"/> </intent-filter> </receiver>
your current radius should less radius of geofence. entered event triggers once entire "radius circle" inside of geofence.
also 2m geofence small, , suggest @ least ±10m.
Comments
Post a Comment