list-sensors

command
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Example: list default sensors and their properties.

Obtains the sensor manager singleton and queries default sensors for the most common types (accelerometer, gyroscope, light, proximity, magnetic field). For each sensor that is present on the device, the program prints its name, vendor, type code, resolution, and minimum delay between events.

Not every device has every sensor. Because DefaultSensor always returns a non-nil *Sensor wrapper (even when the underlying C pointer is NULL), calling methods on an absent sensor would crash. This example uses a recover guard so that missing sensors are reported gracefully instead of terminating the program.

This program must run on an Android device.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL