Dela via


Geofence Constructors

Definition

Overloads

Geofence(String, IGeoshape)

Initializes a new Geofence object given the id and the shape of the geofence.

Geofence(String, IGeoshape, MonitoredGeofenceStates, Boolean)

Initializes a new Geofence object given the id, the shape of the geofence, the states to monitor the geofence for, and the singleUse flag.

Geofence(String, IGeoshape, MonitoredGeofenceStates, Boolean, TimeSpan)

Initializes a new Geofence object given the id, the shape of the geofence, the states to monitor the geofence for, the singleUse flag, and the dwellTime for the geofence.

Geofence(String, IGeoshape, MonitoredGeofenceStates, Boolean, TimeSpan, DateTime, TimeSpan)

Initializes a new Geofence object given the id, the shape of the geofence, the states to monitor the geofence for, the singleUse flag, the dwellTime for the geofence, the time to start monitoring the geofence, and the duration of the geofence.

Geofence(String, IGeoshape)

Initializes a new Geofence object given the id and the shape of the geofence.

public:
 Geofence(Platform::String ^ id, IGeoshape ^ geoshape);
 Geofence(winrt::hstring const& id, IGeoshape const& geoshape);
public Geofence(string id, IGeoshape geoshape);
function Geofence(id, geoshape)
Public Sub New (id As String, geoshape As IGeoshape)

Parameters

id
String

Platform::String

winrt::hstring

The Id of the geofence.

geoshape
IGeoshape

The area that defines the geofence to monitor.

Windows requirements

App capabilities
location

Remarks

When this constructor is used, the MonitoredStates will default to monitor for both the Entered and Exited states, SingleUse will default to false, the DwellTime will default to 10 seconds, the StartTime will default to 0 meaning start immediately, and the Duration will default to 0, meaning forever.

The id value must be non-null and less than 64 characters.

The geoshape parameter must be a non-null Geocircle with a SpatialReferenceId that matches the platform or an exception will be thrown.

See also

Applies to

Geofence(String, IGeoshape, MonitoredGeofenceStates, Boolean)

Initializes a new Geofence object given the id, the shape of the geofence, the states to monitor the geofence for, and the singleUse flag.

public:
 Geofence(Platform::String ^ id, IGeoshape ^ geoshape, MonitoredGeofenceStates monitoredStates, bool singleUse);
 Geofence(winrt::hstring const& id, IGeoshape const& geoshape, MonitoredGeofenceStates const& monitoredStates, bool const& singleUse);
public Geofence(string id, IGeoshape geoshape, MonitoredGeofenceStates monitoredStates, bool singleUse);
function Geofence(id, geoshape, monitoredStates, singleUse)
Public Sub New (id As String, geoshape As IGeoshape, monitoredStates As MonitoredGeofenceStates, singleUse As Boolean)

Parameters

id
String

Platform::String

winrt::hstring

The Id of the geofence.

geoshape
IGeoshape

The area that defines the geofence to monitor.

monitoredStates
MonitoredGeofenceStates

The states to monitor the geofence for.

singleUse
Boolean

bool

True indicates the geofence should be monitored only for one use. False indicates the geofence should be monitored for multiple uses.

Windows requirements

App capabilities
location

See also

Applies to

Geofence(String, IGeoshape, MonitoredGeofenceStates, Boolean, TimeSpan)

Initializes a new Geofence object given the id, the shape of the geofence, the states to monitor the geofence for, the singleUse flag, and the dwellTime for the geofence.

public:
 Geofence(Platform::String ^ id, IGeoshape ^ geoshape, MonitoredGeofenceStates monitoredStates, bool singleUse, TimeSpan dwellTime);
 Geofence(winrt::hstring const& id, IGeoshape const& geoshape, MonitoredGeofenceStates const& monitoredStates, bool const& singleUse, TimeSpan const& dwellTime);
public Geofence(string id, IGeoshape geoshape, MonitoredGeofenceStates monitoredStates, bool singleUse, System.TimeSpan dwellTime);
function Geofence(id, geoshape, monitoredStates, singleUse, dwellTime)
Public Sub New (id As String, geoshape As IGeoshape, monitoredStates As MonitoredGeofenceStates, singleUse As Boolean, dwellTime As TimeSpan)

Parameters

id
String

Platform::String

winrt::hstring

The Id of the geofence.

geoshape
IGeoshape

The area that defines the geofence to monitor.

monitoredStates
MonitoredGeofenceStates

The states to monitor the geofence for.

singleUse
Boolean

bool

True indicates the geofence should be monitored only for one use. False indicates the geofence should be monitored for multiple uses.

dwellTime
TimeSpan TimeSpan

The time that a position has to be in or out of the geofence in order for the notification to be triggered. This object must represent a positive value.

Windows requirements

App capabilities
location

See also

Applies to

Geofence(String, IGeoshape, MonitoredGeofenceStates, Boolean, TimeSpan, DateTime, TimeSpan)

Initializes a new Geofence object given the id, the shape of the geofence, the states to monitor the geofence for, the singleUse flag, the dwellTime for the geofence, the time to start monitoring the geofence, and the duration of the geofence.

public:
 Geofence(Platform::String ^ id, IGeoshape ^ geoshape, MonitoredGeofenceStates monitoredStates, bool singleUse, TimeSpan dwellTime, DateTime startTime, TimeSpan duration);
 Geofence(winrt::hstring const& id, IGeoshape const& geoshape, MonitoredGeofenceStates const& monitoredStates, bool const& singleUse, TimeSpan const& dwellTime, DateTime const& startTime, TimeSpan const& duration);
public Geofence(string id, IGeoshape geoshape, MonitoredGeofenceStates monitoredStates, bool singleUse, System.TimeSpan dwellTime, System.DateTimeOffset startTime, System.TimeSpan duration);
function Geofence(id, geoshape, monitoredStates, singleUse, dwellTime, startTime, duration)
Public Sub New (id As String, geoshape As IGeoshape, monitoredStates As MonitoredGeofenceStates, singleUse As Boolean, dwellTime As TimeSpan, startTime As DateTimeOffset, duration As TimeSpan)

Parameters

id
String

Platform::String

winrt::hstring

The Id of the geofence.

geoshape
IGeoshape

The area that defines the geofence to monitor.

monitoredStates
MonitoredGeofenceStates

The states to monitor the geofence for.

singleUse
Boolean

bool

True indicates the geofence should be monitored only for one use. False indicates the geofence should be monitored for multiple uses.

dwellTime
TimeSpan TimeSpan

The time that a position has to be in or out of the geofence in order for the notification to be triggered.This object must represent a positive value.

startTime
DateTime DateTimeOffset

The time to start monitoring the geofence.

duration
TimeSpan TimeSpan

The duration of time to monitor the geofence for. The duration begins at the startTime. This object must represent a positive value.

Windows requirements

App capabilities
location

Remarks

You must specify the Entered or Exited states, or both, for a geofence to be monitored. It is not possible to create a geofence that only monitors the Removed state.

The id value must be non-null and less than 64 characters.

The geoshape parameter must be a non-null Geocircle with a SpatialReferenceId that matches the platform or an exception will be thrown.

If the expiration date for the geofence - which is the start time plus the duration time span - occurs sooner than the creation time plus the dwell time value, an exception will be thrown.

See also

Applies to