Search code examples
androidwear-osandroid-6.0-marshmallowandroid-sensorssensormanager

Android sensor sampling rate won't drow below 60 hz


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.


Solution

  • 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.