Sensor Stepcounter Sometime Not Work Well On Samsung Device
Solution 1:
We've also encountered in this problem, when using the default steps sensors of the phone. However, we're using TYPE_STEP_DETECTOR - and we don't have the issue you have(more than 100000 users), so perhaps something is wrong there? This issue is quite resemble in the way that you can't rely on such mechanism. For our case, we've received a lot of steps in a short amount of time. Even if you're a tiger, you can't make that many steps.
Here's the thing, Samsung manipulates the OS and there are a lot of stuff that works well on say, nexus devices, BUT not on Samsung devices. After trying to fix the behaviour of the step sensor, we've figured out we need an alternative for Samsung phones, or, for phones that do not support it.
FYI, We've encountered that some phones (mostly Motorola) doesn't have the steps sensors in the device, so trying to find the sensors, returns null.
SensorManagersensorManager= (SensorManager) getSystemService(SENSOR_SERVICE);
SensorstepDetector= sensorManager.getDefaultSensor(Sensor.TYPE_STEP_DETECTOR);
if (stepsDetector != null) {
//Do something
}
You could implement your own mechanism, using wakelock and accelerometer(which has a huge battery consumption, watch out).
Solution 2:
Do you unregister the sensor when you leave the app? According to the SDK documentation :
"If you want to continuously track the number of steps over a long period of time, do NOT unregister for this sensor, so that it keeps counting steps in the background even when the AP is in suspend mode and report the aggregate count when the AP is awake".
Hope this will help...
Post a Comment for "Sensor Stepcounter Sometime Not Work Well On Samsung Device"