ActivitySensor Class

Definition

Represents a sensor that provides the activity and status of a sensor.

public ref class ActivitySensor sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ActivitySensor final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ActivitySensor
Public NotInheritable Class ActivitySensor
Inheritance
Object Platform::Object IInspectable ActivitySensor
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

For an example implementation, see the activity sensor sample.

Remarks

Note

This class is not supported in JavaScript

In order to use ActivitySensor, you need to define the activity device capability in your app manifest file.

<Capabilities>
    <DeviceCapability Name="activity"/>
</Capabilities>

Properties

DeviceId

Gets the device identifier.

MinimumReportInterval

Gets the minimum report interval supported by the sensor.

PowerInMilliwatts

Gets the power in milliwatts that the sensor consumes.

SubscribedActivities

Gets the list of activity types that the sensor pledges to perform.

SupportedActivities

Gets the list of activity types that the sensor supports.

Methods

FromIdAsync(String)

Asynchronously obtains the sensor from its identifier.

GetCurrentReadingAsync()

Asynchronously gets the current sensor reading.

GetDefaultAsync()

Asynchronously obtains the default sensor.

GetDeviceSelector()

Gets the device selector.

GetSystemHistoryAsync(DateTime)

Asynchronously gets sensor readings from a specific time.

GetSystemHistoryAsync(DateTime, TimeSpan)

Asynchronously gets sensor readings from a specific time and duration.

Events

ReadingChanged

Occurs each time the sensor reports a new sensor reading.

Applies to

See also