0

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?

3 Answers3

0

See if this helps:

Playbook Orientation

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • It looks like that's for AIR, not native. I'm hoping there is something similar available for native but those xml fields are not available in the bar descriptor. –  May 07 '12 at 14:15
  • For Java-based BB smartphones, orientation can be locked using the `net.rim.device.api.ui.UiEngineInstance.setAcceptableDirections()` method. I don't know if there is an NDK equivilent, maybe `screen_set_window_property_*()` or `screen_set_display_property_*()` specifying `SCREEN_PROPERTY_ROTATION`. – Remy Lebeau May 07 '12 at 23:30
  • Otherwise, I think you might have to detect the current orientation at app startup and then [catch orientation change events](https://bdsc.webapps.blackberry.com/native/documentation/recipe_orientation_1935323_11.html) so you can adjust your drawing coordinates to stay relative to the current orientation while having the appearance of a locked orientation. – Remy Lebeau May 07 '12 at 23:32
  • 1
    My drawing and input is already adjusted, luckily cocos2d-x does that just fine with a minor tweak. The problem is that under BB10 Dev Alpha the application locks the phone in portrait mode when I launch my app. I need it to do the same thing but for landscape. This seems to be the default behavior on playbook, just not on BB10 Dev Alpha. –  May 08 '12 at 15:31
  • Odd, because some of RIM's apps lock into landspace mode, so there has to be a way. I woud suggest you ask in the Blackberry Support forums. – Remy Lebeau May 08 '12 at 18:14
0

The orientation is determined by the accelerometer and the OS "lock orientation" setting.

Your application is not required to rotate itself to match the orientation, although this is recommended. If you don't the system bezel swipes won't match the orientation used by your application, probably resulting in a confused user.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
0

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

techsaint
  • 752
  • 9
  • 22