I have an Android PC with root out-of-box connected to an external monitor (HDMI & USB) that always displays in landscape, even though my app specifies portrait in the activity declaration in Manifest:
android:screenOrientation="portrait"
I am trying to execute the following command from this SO post to force portrait:
process = Runtime.getRuntime().exec("adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
which should set the screen to portrait, but the display always remains in landscape. No exceptions are recorded.
I have also used the following command (No "adb shell"):
process = Runtime.getRuntime().exec("content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0");
There is only one USB, and one micro USB port on the Android PC. With debugging enabled, I cannot enumerate the device in DDMS, nor execute shell commands from BASH connecting my dev PC to the micro USB port on the Android PC. So, I am trying to do this from my Android app.
Please advise
Aucun commentaire:
Enregistrer un commentaire