Search code examples
androidandroid-sensorsgalaxy-tabsensormanager

SensorManager type Accelerometer not working on Galaxy Tab 3 Lit 7.0"


I tested with other devices like Moto g, Galaxy s4, Nexus 7. It's working fine on those. onSensorChanged method is getting called is well. But some users complains that app is not working on Galaxy Tab 3 Lit 7.0". So my question is, Galaxy Tab 3 Lit 7.0" has any issue with sensors? I don't have this device to test it. Any help on this will be appreciated. .

Here is how I register it.

mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);

            mAccelerometer = mSensorManager
                    .getDefaultSensor(Sensor.TYPE_ACCELEROMETER);

Solution

  • I'm not sure if you resolved this issue, but to help others with similar problems it has to do with missing sensors. My example would be the Galaxy Tab 4. It only has 2 sensors, with the sensor we assumed existed, missing. At least according to SensorManager.getSensorList(Sensor.TYPE_ALL) and the missing Sensor among the list. You would essentially need a fallback sensor to try and gracefully handle that, or just let the user know.

    So to answer the question, the problem is likely a missing sensor. A fallback sensor is necessary.