I'm reading out the accelerometer sensor on a Sony Smartwatch 3. Since the Android Wear 1.5 update the sampling rate won't drop below about 60hz, regardless weather I use SENSOR_DELAY_NORMAL
, SENSOR_DELAY_UI
or SENSOR_DELAY_GAME
. Before the update SENSOR_DELAY_NORMAL
resulted in a sampling rate of about 18 samples/seconds.
accelerometer.getMaxDelay()
still returns 62500, which would be 16 samples/sec. I also tried setting the desired delay directly, when registering the sensor with sensorManager.registerSensor(this, accelerometer, 62500)
but this doesn't work either.
Has anybody any idea of how I can reduce the sampling rate? It's very important for my app to be energy efficient, thats why the low sampling rate is important.
Docs say next about samplingPeriodUs
:
This is only a hint to the system. Events may be received faster or
slower than the specified rate. Usually events are received faster.
So, IMHO you should just ignore some amount of sensor events, as was proposed by Alex. Dry run for sensor event (i.e. without actual processing shouldn't be very power consuming).
How could it have been different: Not the Android update changed the behavior, it was my misunderstanding.
For everyone who might have problems with sensor batching or sampling rates:
- The sampling rate might be different, when the display is on or off. In my case it was 60hz when on and 18hz when off.
- Sensor batching might not be working, when the device is connected to a power source. For me I head to unplug the USB-cable. Bluetooth debugging might be helpful in that case.