LightSensor.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.
Returns the default ambient-light sensor.
public:
static LightSensor ^ GetDefault();
static LightSensor GetDefault();
public static LightSensor GetDefault();
function getDefault()
Public Shared Function GetDefault () As LightSensor
Returns
The default ambient-light sensor or null if no integrated light sensors are found.
Examples
The following example demonstrates how a UWP app built with XAML and C# used this method to establish a connection to the default light sensor.
_sensor = LightSensor.GetDefault();
Remarks
This method only returns values for a light sensor 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.