I want to check if the Android device has an accelerometer or not so that I can put a toast message saying that the game will not work properly on the current device if there is no accelerometer. I am looking for something like this:
if(DEVICE_HAS_ACCELEROMETER == false){ Toast.makeText(context,"No Accelerometer Found.",Toast.LENGTH_LONG).show(); }
If you can fill out the DEVICE_HAS_ACCELEROMETER part, that would do the job.
PS: I do not work.
source share