@Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (GeofenceTransitionsIntentService.GEOFENCE_ENTERED.equals(action)) { listener.onGeofenceEntered(); } else if (GeofenceTransitionsIntentService.GEOFENCE_EXIT.equals(action)) { listener.onGeofenceExit(); } }
@Override public void onConnectionFailed(ConnectionResult connectionResult) { Log.e(TAG, "LocationServices connection failed"); state = State.DISCONNECTED; listener.onGeofenceApiConnectionFailed(connectionResult.getErrorMessage()); }
@Override public void onConnected(Bundle bundle) { Log.d(TAG, "LocationServices connected"); listener.onGeofenceApiConnected(); state = State.CONNECTED; fetchGeofences(); final IntentFilter filter = new IntentFilter(GeofenceTransitionsIntentService.GEOFENCE_ENTERED); filter.addAction(GeofenceTransitionsIntentService.GEOFENCE_EXIT); LocalBroadcastManager.getInstance(context).registerReceiver(localReceiver, filter); }