Accelerometer.GetDefault Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetDefault() |
Returns the default accelerometer. |
GetDefault(AccelerometerReadingType) |
Returns the default accelerometer of a specific type of sensor. The possible accelerometer sensors are defined by AccelerometerReadingType. |
GetDefault()
Returns the default accelerometer.
public:
static Accelerometer ^ GetDefault();
static Accelerometer GetDefault();
/// [Windows.Foundation.Metadata.Overload("GetDefault")]
static Accelerometer GetDefault();
public static Accelerometer GetDefault();
[Windows.Foundation.Metadata.Overload("GetDefault")]
public static Accelerometer GetDefault();
function getDefault()
Public Shared Function GetDefault () As Accelerometer
Returns
The default accelerometer or null if no integrated accelerometers are found.
- Attributes
Examples
The following example demonstrates how a UWP app built with XAML and C# used this method to establish a connection to the default accelerometer.
_accelerometer = Accelerometer.GetDefault();
Remarks
This method only returns values for an accelerometer that has been integrated into the computer by the manufacturer. A null value will be returned if the specified sensor is not available in the system.
When a system is in Connected Standby, a call to the GetDefault method will return immediately with a null result.
See also
Applies to
GetDefault(AccelerometerReadingType)
Returns the default accelerometer of a specific type of sensor. The possible accelerometer sensors are defined by AccelerometerReadingType.
public:
static Accelerometer ^ GetDefault(AccelerometerReadingType readingType);
/// [Windows.Foundation.Metadata.Overload("GetDefaultWithAccelerometerReadingType")]
static Accelerometer GetDefault(AccelerometerReadingType const& readingType);
[Windows.Foundation.Metadata.Overload("GetDefaultWithAccelerometerReadingType")]
public static Accelerometer GetDefault(AccelerometerReadingType readingType);
function getDefault(readingType)
Public Shared Function GetDefault (readingType As AccelerometerReadingType) As Accelerometer
Parameters
- readingType
- AccelerometerReadingType
Indicates the type of accelerometer to retrieve.
Returns
The default accelerometer or null if no integrated accelerometers are found.
- Attributes
Windows requirements
Device family |
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v3.0)
|