Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Revision as of 04:39, 1 August 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Change display mode and trigger orientation change using Symbian C++

From Wiki
Jump to: navigation, search
Article Metadata
Created: User:Nokia Developer KB (23 Aug 2011)
Last edited: hamishwillee (01 Aug 2012)
Article Metadata
Tested with
Devices(s): Tested on: Nokia N95, Nokia N78,
Nokia N96, Nokia 5800 XpressMusic,
Nokia N8-00
Platform(s): S60 3rd Edition, FP1
S60 3rd Edition, FP2
S60 5th Edition
S60 5th Edition
S60 3rd Edition (initial release)
Keywords: KPSUidUikon, KUikLayoutState
Created: (23 Aug 2011)
Last edited: hamishwillee (01 Aug 2012)

Note.pngNote: The required header, uikoninternalpskeys.h, is not available in the Symbian^3 SDK.


This solution enables you to change the display mode and trigger the orientation change to all open apps.


Here is the code snippet for rotating orientation.

Required capabilities in your .mmp file:

CAPABILITY WriteDeviceData ReadDeviceData SwEvent

KPSUidUikon is part of uikon_status_api.

const TUid KPSUidUikon = { 0x101F8773 };
const TUint32 KUikLayoutState = 0x00000008;
 CWsScreenDevice* dev = CEikonEnv::Static()->ScreenDevice();
// Orientation to landscape
TInt err = RProperty::Set( KPSUidUikon, KUikLayoutState, 1 );
if ( err == KErrNone )
dev->SetScreenMode( 1 );
 // Orientation to portrait
TInt err = RProperty::Set( KPSUidUikon, KUikLayoutState, 0 );
if ( err == KErrNone )
dev->SetScreenMode( 0 );

For Symbian^3, KUikPreferredOrientation will be used to get the corresponding rotation of the device.

TInt orientation;
TInt err = RProperty::Get( KPSUidUikon, KUikPreferredOrientation, orientation );
User::LeaveIfError( err );
This page was last modified on 1 August 2012, at 04:39.
42 page views in the last 30 days.