Get Auto Turn Information on Android

I am working on an Android application for which I would like to know if Auto-Rotate is enabled. Does anyone know how I can get this? Therefore, just for clarity: I only need to know whether the Auto-Rotate user is enabled in their settings or not.

+6
source share
1 answer

On off. You can get information about automatic rotation. Using Settings.System.ACCELEROMETER_ROTATION as:

 if (android.provider.Settings.System.getInt(getContentResolver(),Settings.System.ACCELEROMETER_ROTATION, 0) == 1){ Toast.makeText(Rotation.this, "Rotation ON", Toast.LENGTH_SHORT).show(); } else{ Toast.makeText(Rotation.this, "Rotation OFF", Toast.LENGTH_SHORT).show(); } 
+14
source

Source: https://habr.com/ru/post/927605/


All Articles