Windows Dev Center

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

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.

Syntax


var geofence = new Windows.Devices.Geolocation.Geofencing.Geofence(id, geoshape, monitoredStates, singleUse, dwellTime, startTime, duration);

Parameters

id

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

The Id of the geofence.

geoshape

Type: IGeoshape

The area that defines the geofence to monitor.

monitoredStates

Type: MonitoredGeofenceStates

The states to monitor the geofence for.

singleUse

Type: Boolean [JavaScript] | System.Boolean [.NET] | Platform::Boolean [C++]

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

dwellTime

Type: Number [JavaScript] | System.TimeSpan [.NET] | Windows::Foundation::TimeSpan [C++]

The time that a position has to be in or out of the geofence in order for the notification to be triggered.

startTime

Type: Date [JavaScript] | System.DateTimeOffset [.NET] | Windows::Foundation::DateTime [C++]

The time to start monitoring the geofence.

duration

Type: Number [JavaScript] | System.TimeSpan [.NET] | Windows::Foundation::TimeSpan [C++]

The duration of time to monitor the geofence for. The duration begins at the startTime.

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.

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 dwelltime and duration parameters must be non-negative timespans and the startTime parameter must not have a negative value.

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.

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Devices.Geolocation.Geofencing
Windows::Devices::Geolocation::Geofencing [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8.1

Minimum supported server

None supported

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Devices.Geolocation.Geofencing
Windows::Devices::Geolocation::Geofencing [C++]

Metadata

Windows.winmd

See also

Geofencing, start to finish
Geofence
Geofence(String, IGeoshape)
Geofence(String, IGeoshape, MonitoredGeofenceStates, Boolean)
Geofence(String, IGeoshape, MonitoredGeofenceStates, Boolean, TimeSpan)

 

 

Show:
© 2015 Microsoft