androidandroid-studioandroid-sensors

Motion sensors not working on phone (Android Studio)


This is my first time using motion sensors. I followed the code here: https://www.geeksforgeeks.org/how-to-build-an-application-to-test-motion-sensors-in-android/

I also watched Youtube videos on these sensors examples and they show the sensors working on the emulator, but when I try to do it myself using my phone (connected with USB cable), it doesn't work. The screen doesn't change color when I move the phone.

I looked in the Developer Options setting on the phone but there's nothing about enabling motion sensors so it must have been enabled already, but it's still not working.


Solution

  • Maybe it's because your phone doesn't have this sensor. Some sensors like compass or accelerometer are not available on all devices