FileDocCategorySizeDatePackage
GeofenceHardwareRequest.javaAPI DocAndroid 5.1 API6261Thu Mar 12 22:22:10 GMT 2015android.hardware.location

GeofenceHardwareRequest

public final class GeofenceHardwareRequest extends Object
This class represents the characteristics of the geofence.

Use this in conjunction with {@link GeofenceHardware} APIs.

hide

Fields Summary
static final int
GEOFENCE_TYPE_CIRCLE
private int
mType
private double
mLatitude
private double
mLongitude
private double
mRadius
private int
mLastTransition
private int
mUnknownTimer
private int
mMonitorTransitions
private int
mNotificationResponsiveness
private int
mSourceTechnologies
Constructors Summary
Methods Summary
public static android.hardware.location.GeofenceHardwareRequestcreateCircularGeofence(double latitude, double longitude, double radius)
Create a circular geofence.

param
latitude Latitude of the geofence
param
longitude Longitude of the geofence
param
radius Radius of the geofence (in meters)

        GeofenceHardwareRequest geofenceRequest = new GeofenceHardwareRequest();
        geofenceRequest.setCircularGeofence(latitude, longitude, radius);
        return geofenceRequest;
    
public intgetLastTransition()
Returns the last transition of this geofence.

        return mLastTransition;
    
public doublegetLatitude()
Returns the latitude of this geofence.

        return mLatitude;
    
public doublegetLongitude()
Returns the longitude of this geofence.

        return mLongitude;
    
public intgetMonitorTransitions()
Returns transitions monitored for this geofence.

        return mMonitorTransitions;
    
public intgetNotificationResponsiveness()
Returns the notification responsiveness of this geofence.

        return mNotificationResponsiveness;
    
public doublegetRadius()
Returns the radius of this geofence.

        return mRadius;
    
public intgetSourceTechnologies()
Returns the source technologies to track this geofence.

        return mSourceTechnologies;
    
intgetType()

        return mType;
    
public intgetUnknownTimer()
Returns the unknownTimer of this geofence.

        return mUnknownTimer;
    
private voidsetCircularGeofence(double latitude, double longitude, double radius)


            
        mLatitude = latitude;
        mLongitude = longitude;
        mRadius = radius;
        mType  = GEOFENCE_TYPE_CIRCLE;
    
public voidsetLastTransition(int lastTransition)
Set the last known transition of the geofence.

param
lastTransition The current state of the geofence. Can be one of {@link GeofenceHardware#GEOFENCE_ENTERED}, {@link GeofenceHardware#GEOFENCE_EXITED}, {@link GeofenceHardware#GEOFENCE_UNCERTAIN}.

        mLastTransition = lastTransition;
    
public voidsetMonitorTransitions(int monitorTransitions)
Set the transitions to be monitored.

param
monitorTransitions Bitwise OR of {@link GeofenceHardware#GEOFENCE_ENTERED}, {@link GeofenceHardware#GEOFENCE_EXITED}, {@link GeofenceHardware#GEOFENCE_UNCERTAIN}

        mMonitorTransitions = monitorTransitions;
    
public voidsetNotificationResponsiveness(int notificationResponsiveness)
Set the notification responsiveness of the geofence.

param
notificationResponsiveness (milliseconds) Defines the best-effort description of how soon should the callback be called when the transition associated with the Geofence is triggered. For instance, if set to 1000 millseconds with {@link GeofenceHardware#GEOFENCE_ENTERED}, the callback will be called 1000 milliseconds within entering the geofence.

       mNotificationResponsiveness = notificationResponsiveness;
    
public voidsetSourceTechnologies(int sourceTechnologies)
Set the source technologies to use while tracking the geofence. The value is the bit-wise of one or several source fields defined in {@link GeofenceHardware}.

param
sourceTechnologies The set of source technologies to use.

        int sourceTechnologiesAll = GeofenceHardware.SOURCE_TECHNOLOGY_GNSS
                | GeofenceHardware.SOURCE_TECHNOLOGY_WIFI
                | GeofenceHardware.SOURCE_TECHNOLOGY_SENSORS
                | GeofenceHardware.SOURCE_TECHNOLOGY_CELL
                | GeofenceHardware.SOURCE_TECHNOLOGY_BLUETOOTH;

        int sanitizedSourceTechnologies = (sourceTechnologies & sourceTechnologiesAll);
        if (sanitizedSourceTechnologies == 0) {
            throw new IllegalArgumentException("At least one valid source technology must be set.");
        }

        mSourceTechnologies = sanitizedSourceTechnologies;
    
public voidsetUnknownTimer(int unknownTimer)
Set the unknown timer for this geofence.

param
unknownTimer The time limit after which the {@link GeofenceHardware#GEOFENCE_UNCERTAIN} transition should be triggered. This paramter is defined in milliseconds.

        mUnknownTimer = unknownTimer;