public interface ProximityKitGeofenceNotifier
On most devices, the geofence service uses only network location for geofence triggering. The service uses this approach because network location consumes much less power, it takes less time to get discrete locations, and most importantly it's available indoors. Starting with Google Play services 3.2, the geofence service calculates the overlapping ratio of the location circle and the geofence circle and only generates the entrance alert when the ratio is at least 85% for a bigger geofence or 75% for a smaller geofence. For an exit alert, the ratio threshold used is 15% or 25%.
ProximityKitGeofenceRegion
,
ProximityKitMonitorNotifier
,
ProximityKitManager.getProximityKitGeofenceNotifier()
,
ProximityKitManager.setProximityKitGeofenceNotifier(ProximityKitGeofenceNotifier)
,
Creating and Monitoring Geofences > Use Best Practices for Geofencing: Choose the optimal
radius for your geofence
,
Creating and Monitoring Geofences > Troubleshoot the Geofence Entrance Event
Modifier and Type | Field and Description |
---|---|
static int |
INSIDE
Indicates the Android device is inside the geofence region.
|
static int |
OUTSIDE
Indicates the Android device is outside the geofence region.
|
Modifier and Type | Method and Description |
---|---|
void |
didDetermineStateForGeofence(int state,
ProximityKitGeofenceRegion geofence)
Provides major state events for a geofence region.
|
void |
didEnterGeofence(ProximityKitGeofenceRegion geofence)
Called when the Android device is inside the defined
geofence region. |
void |
didExitGeofence(ProximityKitGeofenceRegion geofence)
Called when the Android device transitions to outside the defined
geofence region. |
static final int INSIDE
static final int OUTSIDE
void didDetermineStateForGeofence(int state, ProximityKitGeofenceRegion geofence)
ProximityKitGeofenceNotifier.INSIDE
when at the
Android device determines that it is within the bounds of the geofence
region.
Conversely, this is called with a value of ProximityKitGeofenceNotifier.OUTSIDE
when the device leaves the geofence
region it was previously within.state
- Major state of geofence
. Either ProximityKitGeofenceNotifier.INSIDE
or ProximityKitGeofenceNotifier.OUTSIDE
.geofence
- The ProximityKitGeofenceRegion
defining the boundary criteria.void didEnterGeofence(ProximityKitGeofenceRegion geofence)
geofence
region.geofence
- The ProximityKitGeofenceRegion
boundary the device is now within.void didExitGeofence(ProximityKitGeofenceRegion geofence)
geofence
region.geofence
- The ProximityKitGeofenceRegion
boundary the device is no longer within.