AI-generated Key Takeaways
-
GeofencingRequest
specifies a list of geographical areas (geofences) to monitor and how related notifications should be delivered. -
You can define the initial triggering behavior for notifications, such as when a device enters, exits, or dwells within a geofence.
-
Use
GeofencingClient.addGeofences()
to start monitoring the specified geofences. -
The
GeofencingRequest
object is built using aGeofencingRequest.Builder
and includes details about the geofences and initial trigger conditions. -
It provides methods for retrieving the list of geofences and the initial trigger behavior.
Specifies the list of geofences to be monitored and how the geofence notifications should be reported.
Refer to
GeofencingClient.addGeofences(GeofencingRequest, android.app.PendingIntent)
on how
to monitor geofences.
Nested Class Summary
class | GeofencingRequest.Builder | A builder for GeofencingRequest . |
|
@interface | GeofencingRequest.InitialTrigger | The triggering behavior at the moment when the geofences are added. |
Constant Summary
int | INITIAL_TRIGGER_DWELL | A flag indicating that geofencing service should
trigger
Geofence.GEOFENCE_TRANSITION_DWELL notification at the moment when the
geofence is added and if the device is already inside that geofence for some
time. |
int | INITIAL_TRIGGER_ENTER | A flag indicating that geofencing service should
trigger
Geofence.GEOFENCE_TRANSITION_ENTER notification at the moment when the
geofence is added and if the device is already inside that geofence. |
int | INITIAL_TRIGGER_EXIT | A flag indicating that geofencing service should
trigger
Geofence.GEOFENCE_TRANSITION_EXIT notification at the moment when the
geofence is added and if the device is already outside that geofence. |
Inherited Constant Summary
Field Summary
public static final Creator<GeofencingRequest> | CREATOR |
Public Method Summary
List<Geofence> |
getGeofences()
Gets the list of geofences to be monitored.
|
int |
getInitialTrigger()
Gets the triggering behavior at the moment when the geofences are added.
|
String |
toString()
|
void |
writeToParcel(Parcel dest, int
flags)
|
Inherited Method Summary
Constants
public static final int INITIAL_TRIGGER_DWELL
A flag indicating that geofencing service should trigger
Geofence.GEOFENCE_TRANSITION_DWELL
notification at the moment when the
geofence is added and if the device is already inside that geofence for some time.
public static final int INITIAL_TRIGGER_ENTER
A flag indicating that geofencing service should trigger
Geofence.GEOFENCE_TRANSITION_ENTER
notification at the moment when the
geofence is added and if the device is already inside that geofence.
public static final int INITIAL_TRIGGER_EXIT
A flag indicating that geofencing service should trigger
Geofence.GEOFENCE_TRANSITION_EXIT
notification at the moment when the
geofence is added and if the device is already outside that geofence.
Fields
public static final Creator<GeofencingRequest> CREATOR
Public Methods
public List<Geofence> getGeofences ()
Gets the list of geofences to be monitored.
Returns
- the list of geofences to be monitored
public int getInitialTrigger ()
Gets the triggering behavior at the moment when the geofences are added.
Returns
- the triggering behavior at the moment when the geofences are added. It's a
bit-wise of
INITIAL_TRIGGER_ENTER
,INITIAL_TRIGGER_EXIT
, andINITIAL_TRIGGER_DWELL
.