This is a migrated thread and some comments may be shown as answers.

Problem locking Screen to Portrait mode for Android

1 Answer 123 Views
AppBuilder extension for Visual Studio
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dmq
Top achievements
Rank 1
Dmq asked on 30 Jan 2016, 02:16 PM

Hi, as the title says, I'm trying to lock the screen display to portrait mode, I've read other forums which suggested editing the AndroidManifest.xml and config.xml files, I've added the suggested config settings "see below" but still when I run the app in the device simulator, if I rotate the screen 90 Degrees it changes to landscape mode. I'm out of ideas for this so any help would be much appreciated.

 

config.xml
<preference name="orientation" value="portrait" />

AndroidManifest.xml
android:screenOrientation="portrait"

 

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 03 Feb 2016, 01:03 PM
Hello,

To achieve your goal, you can benefit from the verified Screen Orientation plugin. I would suggest you to try the following:
1. subscribe for the deviceready event handler
2. ensure the Screen Orientation plugin is installed (through General Project Properties
3. add the code to lock the specific orientation on deviceready:

// rotate and lock orientation to landscape
window.screen.lockOrientation('landscape');


Please note most of the plugins apart from the core plugins
are not supported to be tested in the device simulator. They are to be tested on a device instead. For detailed reference on the plugins that the device simulator supports across the AppBuilder clients, you can check the table provided in the documentation.  There is a similar table on Limitations of the Companion App.

Let me know how testing the suggested approach on a device works for you.

Regards,
Dimitrina
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
AppBuilder extension for Visual Studio
Asked by
Dmq
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or