Is there any approach to get screen orientation, when device is blocked and screen is turned off? I tried
getResources().getConfiguration().orientation
and
Display display = ((WindowManager) mContext
.getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay();
int rotation = display.getRotation();
but both of them return "portrait" and "0" respectively when sreen is off, no matter what the actual orientation is.