I cant figure out why setting "sensorPortrait" attribute in manifest for an activity doesn't work to allow the activity to go into reverse portrait. This is how I set in manifest
<activity
android:name=".MainActivty"
android:label="Testing"
android:screenOrientation="sensorPortrait"
android:windowSoftInputMode="stateHidden"
android:configChanges="orientation">
</activity>
The above code is not working for me to get both reversePortrait and portrait on Moto E(4.4.4) or Galaxy S3(4.3), but I can confirm it works on a Nexus 7(5.0.1) tablet, I tried several other answers but this one seems to be the easiest and it is seemingly not working for me on 'phones', am I missing some information that is relevant for getting this to work?
I tried the following link which is just as similar as my question but nothing seems helpful regarding this
Activity in portrait or reverse portrait only
Currently with the flag "sensorPortrait" it behaves just like setting "portrait", in phones.
Like in the 70e Android, by default, the screen will automatically rotate. Setting to enable or disable this feature is under 'Launcher' > 'Settings' > 'Display' > 'Auto-Rotate screen'.
Reverse-portrait is defined to be a rotation of the print-stream page to be imaged by 180 degrees with respect to the medium from the portrait orientation.
If you look at the PhoneWindowManager source code, you can see that it checks for the internal value config_allowAllRotations
and uses that to determine if the 180 degree rotation (i.e., reverse portrait on phones) is allowed.
With a default value to false, this means that reverse portrait is disabled on phones. You'll note that the sw600dp value (i.e., tablets) is true, hence why you can use all rotations including reverse portrait on tablet devices.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With