Last active
January 17, 2020 05:49
-
-
Save Lavanyagaur22/aca253b30d841444d6ae34475a0c2d8d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//To get a list of all sensors present on the device. | |
val deviceSensors: List<Sensor> = sensorManager.getSensorList(Sensor.TYPE_ALL) | |
//To get the default gravity sensor present on the device | |
val gravSensor = sensorManager.getDefaultSensor(TYPE_GRAVITY) | |
//To check the power of the sensor if present | |
val power = gravSensor.getPower() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment