Search code examples
c++screenorientationnativeblackberry-playbook

Set playbook native application orientation


I've been looking for a long time and I can't seem to figure out how to set the preferred orientation of an application for Playbook/BB10 using the native SDK.

My application is targeting playbook and BB10 handsets. The application needs to be in landscape for both devices. I'm using Native SDK Version 10.0.4.

I've looked into bps/orientation.h and it seems like it only has functions to retrieve this information, and there's a lot of areas inside screen that seem like they might have something to do with the orientation but I'm not sure.

Anybody else run into this?


Solution

  • I am not sure if you are still looking for this information but to specify the initial orientation of your application, you use the initialWindow tag in your application descriptor file (also called a bar-description.xml file). The following code shows what tags to add to make the orientation of your app initially be in landscape (aspectRatio), and not allow users to change the orientation (autoOrients)

    <initialWindow>
        <aspectRatio>landscape</aspectRatio>
        <autoOrients>false</autoOrients>
    </initialWindow>
    

    There is more information on the autoOrients tag at the official blackberry site: https://developer.blackberry.com/native/documentation/com.qnx.doc.native_sdk.devguide/com.qnx.doc.native_sdk.devguide/topic/r_barfile_dtd_ref_autoorients.html

    The entire DTD can be found here: developer.blackbery.come/native