Page orientation lock on portrait on ONE page - Forum - Mobile - Progress Community

Page orientation lock on portrait on ONE page

 Forum

Page orientation lock on portrait on ONE page

  • I have read all the forum posts here around this topic, but there is no solution. Is it possible to lock the page orientation on 1 page to portrait, so the rotation is not possible? 

    I have also configured the https://github.com/yoik/cordova-yoik-... plugin. I have put on this code on the specific page: 

    document.addEventListener("deviceready", onDeviceReady, false); 
    function onDeviceReady() 


    var so = cordova.plugins.screenorientation; 
    so.setOrientation(so.Orientation.PORTRAIT); 


    It doesn't work. Is there anybody who succesfully implement this plugin? Is there any workaround?

  • Hi,
     
    Can you please try by adding following new entry in the AndroidManifest.xml file located under Source section (Source -> ANDROID -> <App Name> ->AndroidManifest.xml) in the Mobile App Builder.
                    android:screenOrientation="portrait"
     
    Default Value:
     
    <activity android:name=".PhoneGapActivity" android:launchMode="singleTop" android:configChanges="orientation|keyboardHidden|screenSize">
     
    After the Modification:
     
    <activity android:name=".PhoneGapActivity" android:launchMode="singleTop" android:screenOrientation="portrait" android:configChanges="orientation|keyboardHidden|screenSize">
     
    There are also other third party Cordova plug-ins available:
                    https://github.com/cogitor/PhoneGap-OrientationLock
     
    Also, can you please provide the libraries version under App Settings page in Mobile App Builder
                    App Settings -> External resources -> Libraries version
     
     
    Hope this helps.
     
    Thanks and Regards,
    Anil Kumar.
     
    From: mobiletest [mailto:bounce-mobiletest@community.progress.com]
    Sent: Tuesday, January 20, 2015 8:06 PM
    To: TU.Mobile@community.progress.com
    Subject: [Technical Users - Mobile] Page orientation lock on portrait on ONE page
     
    Thread created by mobiletest

    I have read all the forum posts here around this topic, but there is no solution. Is it possible to lock the page orientation on 1 page to portrait, so the rotation is not possible? 

    I have also configured the https://github.com/yoik/cordova-yoik-... plugin. I have put on this code on the specific page: 

    document.addEventListener("deviceready", onDeviceReady, false); 
    function onDeviceReady() 


    var so = cordova.plugins.screenorientation; 
    so.setOrientation(so.Orientation.PORTRAIT); 


    It doesn't work. Is there anybody who succesfully implement this plugin? Is there any workaround?

    Stop receiving emails on this subject.

    Flag this post as spam/abuse.

  • Hi Anil,

    Thanks a lot for you reply. The library version is 3.1. I have tried github.com/.../cordova-yoik-screenorientation and one other, but couldn't get it work. I want to lock only one page. I will try github.com/.../PhoneGap-OrientationLock and will update you whether it works.

    TIA

  • I think i have tested this plugin before. The problem with this plugin is, that it will only work for the first time. When you close the app and open it again, then it will not work (also your navigation buttons will not work anymore). Maybe im not using the right events. I have on page show: window.plugins.orientationLock.lock("portrait");

    and on page hide: window.plugins.orientationLock.unlock();

    Any idea's?

  • Hello

    We've tried to use plugin https://github.com/cogitor/PhoneGap-OrientationLock. We created two screens (say A and B). From screen A we did navigation to screen B. For "page Show" event we created javascript handler and invoke plugin function:

    window.plugins.orientationLock.lock("portrait");

    For "hide" event of screen B we invoke next plugin function:

    window.plugins.orientationLock.unlock();

    Apllication works as expected - screen orientation for page B is locked. Moreover we closed and opened application and screen locking fuctionality is working.  

    Please, if it possible, send us backup of your project.

  • We have tested it on HTC One Android 4.0.3. What devices you tested on?

  • I have test this on an Android phone with version 4.4.4. How can i share the project with support? Creating a support ticket?

  • In order to get backup of the project, please use top menu Actions -> Backup (inside App Builder). After that you can send it to me (pantipov@progress.com).

  • Youre right. I have tested it on another android phone with version 4.4.3, there it works. Maybe its due my phone :(