Skip to main content
Version: v3

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

TypeDescription
objectSensor, such as checking if the positioning sensor is available, pass in the Geolocation sensor construction function

Result

TypeDescription
booleantrue - 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()
}