GeofencingRequest

  • GeofencingRequest specifies the list of geofences to be monitored and how notifications should be reported.

  • It includes a Builder class to construct GeofencingRequests and an InitialTrigger interface to define triggering behavior.

  • Constants like INITIAL_TRIGGER_DWELL, INITIAL_TRIGGER_ENTER, and INITIAL_TRIGGER_EXIT specify the conditions for initial notifications.

  • The class provides methods to get the list of geofences and the initial triggering behavior.

public classGeofencingRequest extendsObject
implementsParcelable

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.BuilderA builder forGeofencingRequest
@interface GeofencingRequest.InitialTriggerThe triggering behavior at the moment when the geofences are added. 

Constant Summary

int INITIAL_TRIGGER_DWELLA 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_ENTERA 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_EXITA 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

From interface android.os.Parcelable
intCONTENTS_FILE_DESCRIPTOR
intPARCELABLE_WRITE_RETURN_VALUE

Field Summary

public static finalCreator<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
void
writeToParcel(Parcel dest, int flags)

Inherited Method Summary

From class java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
finalClass<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()
From interface android.os.Parcelable
abstract int
describeContents()
abstract void
writeToParcel(Parcel arg0, int arg1)

Constants

public static final intINITIAL_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.

Constant Value:4

public static final intINITIAL_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.

Constant Value:1

public static final intINITIAL_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.

Constant Value:2

Fields

public static finalCreator<GeofencingRequest>CREATOR

Public Methods

publicList<Geofence>getGeofences()

Gets the list of geofences to be monitored.

Returns
  • the list of geofences to be monitored

public intgetInitialTrigger()

Gets the triggering behavior at the moment when the geofences are added.

Returns

publicStringtoString()

public voidwriteToParcel(Parcel dest, int flags)

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-10-31 UTC.