Question
I'm developing a native Tizen application and need to lock the screen orientation to portrait mode only. I've checked the tizen-manifest.xml file but couldn't find any relevant tags for screen orientation settings. Could you please advise how to implement this?
Answer
Problem Understanding
The user wants to restrict their Tizen native application to portrait orientation only and is looking for the proper implementation method since the tizen-manifest.xml doesn't provide direct configuration for screen orientation.
Solution Methods
-
Using Elementary Window Rotation API: Tizen provides Elementary API to control window rotation. You can use
elm_win_wm_rotation_available_rotations_setto specify allowed orientations. -
Implementation Steps:
- Check if rotation is supported using
elm_win_wm_rotation_supported_get() - Define an array of allowed rotations (0 for portrait)
- Set the available rotations with
elm_win_wm_rotation_available_rotations_set()
- Check if rotation is supported using
Code Examples
if (elm_win_wm_rotation_supported_get(ad->win))
{
// Array of rotation values (0 = portrait)
int rots[4] = { 0, 90, 180, 270 };
// Set only portrait mode (0) as available
// Last parameter (1) indicates only one orientation is allowed
elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 1);
}
Additional Tips
- The rotation values correspond to:
- 0: Portrait (normal)
- 90: Landscape (90° clockwise)
- 180: Portrait (upside down)
- 270: Landscape (270° clockwise)
- If you want to allow multiple orientations, adjust the last parameter of
elm_win_wm_rotation_available_rotations_set()accordingly - For more details, refer to the Elementary Window Rotation API documentation on samsungtizenos.com