What is the correct way to implement Significant Motion Sensor?

302 views Asked by At

I placed Significant Motion Sensor code from https://developer.android.com/guide/topics/sensors/sensors_motion#sensors-motion-significant in my activity. But the app crashes as soon as it is launched. What is the correct way to implement Significant Motion Sensor?

1

There are 1 answers

0
Fintasys On BEST ANSWER

If

mSensorManager.getDefaultSensor(Sensor.TYPE_SIGNIFICANT_MOTION,true);

returns null it's pretty likely that your device does not support this sensor. You should consider to use Accelerator directly as alternative.