×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    35

    how to get the phones orientation at the app launch.

    Hi

    I need to find out phones orientation at the app launch and then display two bitmaps which are different for portrait mode and landscape mode.

    I have gone through the SDK and have found Orientation() function. but this function gives me "EAppUiOrientationUnspecified".

    in my constructL of the AppUI i am calling

    BaseConstructL(EAknEnableSkin|EAknDisableHighlightAnimation|EAppOrientationAutomatic);
    I am passing "EAppOrientationAutomatic" as my application suportes both landscape and portrait depending on the phones resolution.

    i am using N95.

    is there something i am doing wrong ?
    how can i get the phones orientation at app launch ?

    regards,
    Ravinder chouhan

  2. #2
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: how to get the phones orientation at the app launch.

    You can get it by using the following api:

    ApplicationRect(); from Appui class

    also to get the container's rect only you can say ClientRect();

    hope this helps
    Amit Kankani
    Nokia Developer Champion

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    35

    Re: how to get the phones orientation at the app launch.

    Hi

    thanks for reply.

    ApplicationRect() actually gives me the total screen area to draw this can not tell anything about the orientation of the phone as i am planning to have a single application which supports all resolution, yeah i can find out the orientation using this for some phones ( where i already now the width and height of the phone screen) but this kind of a solution is not generic enough.

    regards,
    Ravinder

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,567

    Re: how to get the phones orientation at the app launch.

    Quote Originally Posted by ravinder007
    ApplicationRect() actually gives me the total screen area to draw this can not tell anything about the orientation of the phone as i am planning to have a single application which supports all resolution, yeah i can find out the orientation using this for some phones ( where i already now the width and height of the phone screen) but this kind of a solution is not generic enough.
    Yes, ApplicationRect is for beginners. Since I am a beginner, I would still try to rely on it. When the width of ApplicationRect is larger than its height, I would guess that the user looks at a landscape-oriented display; otherwise I would guess portrait mode.

  5. #5
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: how to get the phones orientation at the app launch.

    Yes, this method with ApplicationRect() should work for all phones, unless the display is square! :-)

    If it's a square screen (also discovered with ApplicationRect) then portrait and landscape displays ought to be the same.

    Sorcery

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,567

    Re: how to get the phones orientation at the app launch.

    In my opinion the orientation of a square is portrait :-D

  7. #7
    Nokia Developer Expert
    Join Date
    Jan 2007
    Location
    Berlin
    Posts
    22

    Re: how to get the phones orientation at the app launch.

    Another option is to check presence of stacon bottom or similar. This is need for certain devices which have w > h but have only portrait mode....

  8. #8
    Registered User
    Join Date
    Aug 2006
    Posts
    10

    Re: how to get the phones orientation at the app launch.

    Another option that may be of use:

    CWsScreenDevice* screen = CCoeEnv::Static()->ScreenDevice();
    if (screen)
    {
    TInt mode = screen->CurrentScreenMode();
    TPixelsTwipsAndRotation sizeAndRotation;
    screen->GetScreenModeSizeAndRotation(mode, sizeAndRotation);
    // now check sizeAndRotation.iRotation

Similar Threads

  1. Nokia, do you listen to your customers? Problems of your new phones
    By djprofessork in forum General Development Questions
    Replies: 3
    Last Post: 2007-09-24, 15:15
  2. Tryng to launch an app via code on 3rd edition
    By bytesm in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 5
    Last Post: 2007-02-06, 23:40
  3. Dialog's clipping area (again). Nokia experts, please help
    By synov in forum Symbian User Interface
    Replies: 0
    Last Post: 2004-06-26, 14:35
  4. Launch a midlet from C++ app?
    By jamwww in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2003-04-07, 17:52
  5. Launching an app from pJava..
    By krajag in forum PersonalJava
    Replies: 0
    Last Post: 2002-10-10, 19:57

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •