geoQuery.addGeoQueryEventListener(new GeoQueryEventListener() {
@Override
public void onKeyEntered(String key, GeoLocation location) {
Log.d(TAG, "onKeyEntered: Present");
Toast.makeText(GeofenceMapActivity.this, "onKeyEntered: Present", Toast.LENGTH_SHORT).show();
sendNotification("MRF", String.format("%s entered the dangerous area",key));
}
@Override
public void onKeyExited(String key) {
Toast.makeText(GeofenceMapActivity.this, "onKeyExited: Present", Toast.LENGTH_SHORT).show();
Log.d(TAG, "onKeyExited: Present");
sendNotification("MRF", String.format("%s exit the dangerous area",key));
}
@Override
public void onKeyMoved(String key, GeoLocation location) {
Toast.makeText(GeofenceMapActivity.this, "onKeyMoved Present", Toast.LENGTH_SHORT).show();
Log.d("MOVE", String.format("%s move within the dangerous area [%f/%f]", key, location.latitude, location.longitude));
}
@Override
public void onGeoQueryReady() {
Toast.makeText(GeofenceMapActivity.this, "onGeoQueryReady() Present", Toast.LENGTH_SHORT).show();
Log.d(TAG, "Present in onGeoQueryReady: ");
}
@Override
public void onGeoQueryError(DatabaseError error) {
Log.d("ERROR", ""+error);
}
});