1

I have that in mu config.xml

<preference name="Orientation" value="landscape"/>

However applicatoin starts as portrait and I can rotate my screen.

How can I force landscape ?

I read that: Force “Landscape” orientation mode

does not trigger event :

document.addEventListener("orientationchange", function(event){
        switch(window.orientation) 
        {  
            case -90: case 90:
                /* Device is in landscape mode */
                break; 
            default:
                /* Device is in portrait mode */
        }
    });

No effect neither:

<link rel="manifest" href="manifest.json">

Nor this one:

screen.orientation.lock('landscape');

How can I force the portrait mode ?

Here is the

indelxdk.config.crossawalk.app.xml

<?xml version='1.0' encoding='UTF-8'?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:intelxdk="http://xdk.intel.com/ns/v1" id="com.intel.appx.sitechat3.xwalk15" version="0.0.1" android-versionCode="1">
<!--This file is generated by the Intel XDK. Do not edit this file as your edits will be lost.           -->
<!--To change the contents of this file, see the documentation on the intelxdk.config.additions.xml file.-->
<intelxdk:version value="1.0"/>
<intelxdk:cordova-cli version="4.1.2"/>
<name>AP Debug x15 sitechat3</name>
<description>Universal init code for Intel XDK and Cordova device ready detection, as well as within browser.</description>
<author>Intel XDK</author>
<content src="index.html"/>
<access origin="*"/>
<access origin="https:*"/>
<intelxdk:plugin intelxdk:name="StatusBar" intelxdk:value="cordova-plugin-statusbar" intelxdk:version="1.0.0" intelxdk:checksum="b4e7aac6" intelxdk:type="file"/>
<intelxdk:plugin intelxdk:name="Device" intelxdk:value="cordova-plugin-device" intelxdk:version="1.0.1" intelxdk:checksum="adfc61ba" intelxdk:type="file"/>
<intelxdk:plugin intelxdk:name="Splashscreen" intelxdk:value="cordova-plugin-splashscreen" intelxdk:version="2.1.0" intelxdk:checksum="170efb68" intelxdk:type="file"/>
<preference name="android-minSdkVersion" value="14"/>
<preference name="android-targetSdkVersion" value="19"/>
<preference name="android-installLocation" value="auto"/>
<preference name="Fullscreen" value="true"/>
<preference name="Orientation" value="landscape"/>
<intelxdk:crosswalk version="15"/>
<!--creationInfo:{"src":"jsapp/template-blank-cordova-project-lite/sample.zip","projectTypeName":"com.intel.xdk.projecttype.jsapp"}-->
<preference name="debuggable" value="false"/>
<platform name="ios">
    <!-- below requires the splash screen plugin -->
    <!-- docs: https://github.com/apache/cordova-plugin-splashscreen -->
    <preference name="AutoHideSplashScreen" value="false"/>
    <preference name="FadeSplashScreen" value="false"/>
    <preference name="FadeSplashScreenDuration" value="2"/>
    <preference name="ShowSplashScreenSpinner" value="false"/>

    <!-- below requires the status bar plugin -->
    <!-- docs: https://github.com/apache/cordova-plugin-statusbar -->
    <!-- see http://devgirl.org/2014/07/31/phonegap-developers-guid -->
    <preference name="StatusBarOverlaysWebView" value="false"/>
    <preference name="StatusBarBackgroundColor" value="#000000"/>
    <preference name="StatusBarStyle" value="lightcontent"/>
</platform>
<platform name="android">
    <!-- below requires the splash screen plugin -->
    <!-- docs: https://github.com/apache/cordova-plugin-splashscreen -->
    <preference name="SplashMaintainAspectRatio" value="false"/>
</platform>
<intelxdk:crosswalk xmlns:intelxdk="http://xdk.intel.com/ns/v1" xwalk-command-line="--disable-pull-to-refresh-effect"/>
<intelxdk:crosswalk xmlns:intelxdk="http://xdk.intel.com/ns/v1" xwalk-command-line="--ignore-gpu-blacklist"/></widget>
Community
  • 1
  • 1
yarek
  • 11,278
  • 30
  • 120
  • 219

2 Answers2

0

@Yarkek,

You need to set a higher compiler version to implement the latest fixes. Cordova is currently at 5.2.0 your is set to 4.1.2 here: <intelxdk:cordova-cli version="4.1.2"/>. But that is not enough. You should be aware of what you are getting into when you upgrade:

READ: Top Mistakes by Developers new to Cordova/Phonegap
6. Not setting the "phonegap version" for your compiler

I QUOTE

With the CLI version, if you do not assign a version for your platform OR in ''Phonegap Build'' if you do not set the phonegap-version in config.xml, YOU WILL GET THE LATEST VERSION. If you are lucky, your program just works as expected. If you are not lucky, you'll get a set of cascading error.

Luckily for all of us, Holly Schinsky has written a nice blog post to explain it all:

Cordova/PhoneGap Version Confusion
http://devgirl.org/2014/11/07/cordovaphonegap-version-confusion/

To be clear, you *may* need to upgrade your Cordova _AND_ restart your project from scratch. I also recommend setting the versions on all you plugins.

Best of Luck

Community
  • 1
  • 1
0

Check out this screen orientation plugin: cordova-plugin-screen-orientation -- given your tags, I'm assuming you are using the Intel XDK. You'll find it in the featured list of plugins in the plugin manager tool, access it from the Projects tab.

xmnboy
  • 2,314
  • 2
  • 14
  • 31