checkSensor
Start from API_LEVEL
3.0
. Please refer to API_LEVEL.
Check the availability of sensors on the current device.
Type
function checkSensor(sensor: Sensor): Result
Parameters
Sensor
Type | Description |
---|---|
object | Sensor, such as checking if the positioning sensor is available, pass in the Geolocation sensor construction function |
Result
Type | Description |
---|---|
boolean | true - auto-brightness is set to on, false - auto-brightness is set to off |
Example
import { checkSensor, Geolocation } from '@zos/sensor'
const result = checkSensor(Geolocation)
let geolocation = null
if (result) {
geolocation = new Geolocation()
}