Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if device is locked in Portrait mode

Is there way to get information if device settings is enable to locked screen orientation?

like image 684
CoDe Avatar asked Feb 10 '15 11:02

CoDe


1 Answers

You can check the value of Settings.System.ACCELEROMETER_ROTATION setting like so:

final int rotationState = android.provider.Settings.System.getInt(
    getContentResolver(), 
    Settings.System.ACCELEROMETER_ROTATION, 0
);

When the auto-rotation is enabled, this value equals to 1 (and 0 otherwise).

like image 181
aga Avatar answered Oct 31 '22 15:10

aga



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!