public class RegionEvent extends Object
ProximityRegion
event.
Represents a proximity related event for a monitored region (either a beacon or geofence). The events can be:
Modifier and Type | Class and Description |
---|---|
static interface |
RegionEvent.MonitorActions
Set of all region monitoring broadcast actions.
|
static interface |
RegionEvent.RegionState
State of a
ProximityRegion . |
Modifier and Type | Field and Description |
---|---|
static String |
ACTION_REGION_ENTER
Broadcast Action: Sent when the device has entered a monitored region.
|
static String |
ACTION_REGION_EXIT
Broadcast Action: Sent when the device has exited a monitored region.
|
static String |
ACTION_REGION_STATE_DETERMINED
Broadcast Action: Sent on state updates for a monitored region.
|
static int |
INSIDE
Indicates the Android device is inside the defined region.
|
static int |
OUTSIDE
Indicates the Android device is outside the defined region.
|
static int |
UNKNOWN
Indicates an event not generated from a region action.
|
Modifier and Type | Method and Description |
---|---|
static RegionEvent |
fromIntent(Intent intent)
Creates a new
RegionEvent instance from the provided intent . |
int |
getRegionState()
Returns the state of triggering region when the event was broadcast.
|
ProximityRegion |
getTriggeringRegion()
The
ProximityRegion which triggered the event to be broadcast. |
String |
toString()
Returns a string representation of a
RegionEvent . |
public static final int INSIDE
RegionEvent.RegionState
,
Constant Field Valuespublic static final int OUTSIDE
RegionEvent.RegionState
,
Constant Field Valuespublic static final int UNKNOWN
RegionEvent.RegionState
,
Constant Field Valuespublic static final String ACTION_REGION_ENTER
public static final String ACTION_REGION_EXIT
public static final String ACTION_REGION_STATE_DETERMINED
This action is guaranteed to be sent alongside of ACTION_REGION_ENTER
and ACTION_REGION_EXIT
on region state
transitions. It may also be sent after other major events, such as initial monitoring or
kit sync, which do not represent a region transition. The state of RegionEvent
instances generated from this event will contain the most
recent region state at the time the action was broadcast.
public static RegionEvent fromIntent(Intent intent)
RegionEvent
instance from the provided intent
.intent
- the intent containing the region event dataRegionEvent
instanceNullPointerException
- when intent
is null
public int getRegionState()
UNKNOWN
if the intent
passed to fromIntent(Intent)
was not generated for a region event; otherwise either INSIDE
or OUTSIDE
RegionEvent.RegionState
public ProximityRegion getTriggeringRegion()
ProximityRegion
which triggered the event to be broadcast.ProximityRegion
broadcast in the intent; in
the case where the intent
passed to fromIntent(Intent)
was not generated for a region event all fields in the returned event will either be
null
or empty collections