Documentation
¶
Overview ¶
Command android-sensors is a development example (step 31.7): a Material page that opens the accelerometer and the gyroscope through package sensors, shows their latest readings, and logs them twice a second. The device tests start it on the emulator, set the emulator's virtual sensors (adb emu sensor set), and check that the readings follow with the right values and axes; on a phone it is the manual check (tilt the phone and the numbers move, and the arrow of the page turns with it). In a browser on a phone (go run ./cmd/glutter-web serve ./examples/dev/android-sensors) it shows the same, and a tap or a long press vibrates the phone. It uses the public API only.
The log lines (the default logger's, so "INFO " comes first):
sensors open kind=<accelerometer|gyroscope> rate=<n> sensors failed kind=<kind> err=<tag> sensors accelerometer x=<n> y=<n> z=<n> readings=<n> frames=<n> dropped=<n> sensors gyroscope x=<n> y=<n> z=<n> readings=<n> frames=<n> dropped=<n>
where readings is how many readings the listener was given and frames how many calls (batches) it took.