Languages

Menu
Sites
Language
Automatic orientation in Tizen Web application

Hi,

my Tizen Web application must support automatic orientation. Application is based on Tizen Web UI Framework implemented in Tizen SDK 2.0.0a. There is no option to set automatic orientation in config.xml. Auto orientation works fine in Web Simulator, but not in emulator and device. Any idea?

Thanks in advance for your help.

Jan

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

7 Replies
Lakshmi Grandhi
Hi Jan Macura, Tizen doesn't do automation screen changes as per orientation change, we have to register callback for rotation change, once callback is received you have perfrom updating the page as per orientation change, for more details see shopping list application. https://developer.tizen.org/documentation/developer-application-case-study-shopping-list
Jan Macura
Hi, thanks for your reply. I have checked the shopping list application before and noticed that it is not based on native tizen web framework and that application layout is changed when orientation changes, but the status bar and keyboard are always in portrait mode. Changing screen-orientation in config.xml works as expected (tizen web framework components adapts to screen size and orientation, status bar and keyboard are rotated as well). Any idea how to achieve rotation of the status bar and keyboard and adapation of tizen web components to new orientation? thanks in advance, Jan
Lakshmi Grandhi
Hi Jan Macura, yaa emulator/device orientation support is not provided there is already bug in jira https://bugs.tizen.org/jira/browse/TDIST-15
Jan Macura
This bug was reported in may last year and resolution is won't fix. Does it mean that Tizen Web UI framework will not support orientation change?
Lakshmi Grandhi
Its is a wont fix bug in SDK 1.0, there were comments as will plan in next release.
Jan Macura
Here is the solution: var isSupported = tizen.systeminfo.isSupported("DeviceOrientation"); if (isSupported) { console.log("DeviceOrientation is supported"); screen.addEventListener("orientationchange", changeOrientation, false); tizen.systeminfo.addPropertyValueChangeListener("DeviceOrientation", onSuccessCallback, onErrorCallback, { lowThreshold : 0.2 }); } function onSuccessCallback(orientation) { screen.unlockOrientation(); console.log("orientation.status " + orientation.status); switch (orientation.status) { case 0: screen.lockOrientation("portrait-primary"); console.log(" Device current Orientation " + "portrait-primary"); break; case 1: screen.lockOrientation("portrait-secondary"); console.log(" Device current Orientation " + "portrait-secondary"); break; case 2: screen.lockOrientation("landscape-secondary"); console.log(" Device current Orientation " + "landscape-secondary"); break; case 3: screen.lockOrientation("landscape-primary"); console.log(" Device current Orientation " + "landscape-primary"); break; } };
Vladimir Rybakov
This code don't work in release 2.1.0 but you can use following code to resolve the same issue tizen.systeminfo.addPropertyValueChangeListener("DEVICE_ORIENTATION", onSuccessCallback, function(){}, {}); function onSuccessCallback(orientation) { var orientationStatus = orientation.status.toLowerCase(); orientationStatus = orientationStatus.replace('_', '-'); console.log("orientation.status " + orientationStatus); screen.unlockOrientation(); screen.lockOrientation(orientationStatus); };