I have an application which i try to dev with the sencha touch 2 framework on android and iphone.
I want the application orientation to be set as portrait only except for one view.
This view will load a portrait view if device orientation is “portrait” or landscape view if device orientation is “landscape”
For the moment i’m using phonegap on android where i have fixed the orientation as portrait.
But i’m quite lost when it come to create the view which will load either “portrait view” or “landscape view” depending on orientation.
Also will orientation be detected if i stick orientation to portrait in phonegap ?
Thanks for you help
Without any answer from my question i’ll answer to myself.
On Android (phonegap) for example, define in the manifest the orientation as :
Then, before starting the application in the Activity, if you want the application to use Portrait only set it to portrait :
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
super.loadUrl(“file:///android_asset/www/index.html”);
In you JS, when you want to get landscape/portrait to be used, send a command to the main application with an action calling a custom setOrientation code :
OrientationPlugin is just a simple phonegap plugin where you will check the action and call the right code :
}
Then you can always set it back to PORTRAIT whenever you need it from JS.
Hope that help !