I am developing a pedometer android application and for that i used Sensor.TYPE_STEP_DETECTOR which is available from android KitKat. Everything was working fine at Nexus 5 and Samsung Alpha but then i tested my application on Moto G(Lollipop) and Nexus 4(Lollipop), both the device are returning null when i am trying to get sensor of Sensor.TYPE_STEP_DETECTOR type.
Here is my code:
private boolean checkSensorAvailability() {
SensorManager sensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE);
Sensor sensor = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_DETECTOR);
if(sensor==null){return false;}
return true;
}
As per my knowledge this sensor required Accelerometer in Device. Which is available in both devices.
Please help me to resolve this issue.
Thanks
Some devices simply refused that (full wake-up) functionality.
As a workaround, I recommend looking at https://github.com/j4velin/Pedometer/blob/master/src/main/java/de/j4velin/pedometer/SensorListener.java