Вопрос

KitKat introduced sensor batching but I could not find a list of devices that support this. In particular I am interested whether the 2013 HTC One supports it.

Is there a (community maintained?) resource that lists the supported devices?

If sensor batching is not available on the HTC One, are there any good low-power gps tracking libraries? I would love to not have to write my own geofencing code (I assume this would be the most power-saving way to track the phone location)

Thanks

Это было полезно?

Решение

Using this code:

SensorManager mgr = (SensorManager) getSystemService(SENSOR_SERVICE);
Sensor accelerometer = mgr.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
int fifoSize = accelerometer.getFifoReservedEventCount();
if (fifoSize > 0) {
    //Device supports batched sensor updates
}

in an Activity that implemented a SensorEventListener. I found the following devices supported batched sensor updates:

  1. Nexus 5 running Android 4.4.4
  2. Nexus 6 running Android 5.0.1
  3. Samsung Galaxy S5 (G900F Europe variant) running Android 5.0
  4. Samsung Galaxy Note 3 (SM-N9005) running Android 4.4.2
  5. Samsung Galaxy Note 4 (SM-N910F) running Android 4.4.4
  6. Nexus 5X running Android 6.0
  7. Nexus 6P running Android 7.0
  8. Google Pixel running Android 7.1
  9. Samsung Galaxy S7 Edge (SM-G935F) running Android 6.0.1
  10. Samsung Galaxy S7 (SM-G930F) running Android 6.0.1
  11. Sony Xperia XZ running Android 6.0.1
  12. Oneplus 3T running Android 6.0.1
  13. Samsung Galaxy S8 (SM-G950F) running Android 7.0
  14. LG G6 (LG-H870) running Android 7.0
  15. Sony Xperia XZ Premium (G8141) running Android 7.1.1
  16. Oneplus 5 running Android 7.1.1
  17. Google Pixel 2 running Android 8.0

and these did not:

  1. Moto G 1st gen 4G (XT1039) running Android 4.4.4
  2. HTC One M8 running Android 5.0.1
  3. Nexus 9 running Android 5.0.1
  4. Nvidia Shield Tablet running Android 5.0.1
  5. Nexus 4 running Android 5.0.1
  6. Sony Xperia Z running Android 4.4.2
  7. Sony Xperia Z3 compact running Android 5.0.2
  8. One Plus Two running Android 5.1.1
  9. LG G5 SE (LG-H840) running Android 6.0.1
  10. Amazon Kindle Fire 7 (7th gen) running Android 5.1.1

Sorry :(. I will update with more devices when I get my hands on them

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top