As you design your apps to handle orientation changes, there are several considerations that you should keep in mind.
Handling square screens
Some devices, such as the BlackBerry Q10 smartphone, have a screen where the width and height are equal (that is, the screen is square and the aspect ratio is 1:1). For these types of devices, the supported orientation and the current orientation are fixed and do not change during the lifetime of the app.
When you use Cascades APIs, the relationships between SupportedDisplayOrientation values and UIOrientation values are:
- SupportedDisplayOrientation::DisplayLandscape becomes UIOrientation::Landscape
- SupportedDisplayOrientation::DisplayPortrait becomes UIOrientation::Portrait
- SupportedDisplayOrientation::All and SupportedDisplayOrientation::CurrentLocked become whichever orientation is current, the default being UIOrientation::Portrait
- SupportedDisplayOrientation::DeviceNorth becomes UIOrientation::Portrait
Because the orientation doesn't change for devices with square screens, you should make sure that your UI looks appropriate for the orientation that's specified when the app starts. You should also make sure that any UI elements that the user needs aren't hidden or misaligned when the UIOrientation value is fixed. For example, if the app sets SupportedDisplayOrientation to DisplayPortrait, UIOrientation becomes Portrait and required UI elements should work. If you create or adjust these elements when handling Landscape orientation only, they may not appear correctly.
When you use C APIs, the width and height environment variables have the same value for square screens. You should check for this situation when you set up your app window. If your app is running on a device with a square screen, the navigator service doesn't send any orientation events, so you don't have to check for them in your BPS event loop.
If you're using Cascades APIs and your app exports cards for use in other apps, the orientation behavior is slightly different. The parent app is always in charge of how orientation changes are handled, so the supportedDisplayOrientation property is read-only for your card and defaults to SupportedDisplayOrientation::All. All signals that are related to orientation are still emitted, just as they are for apps that aren't cards, and your card must still respond to orientation changes.
For more information on handling orientation changes for your card, see Creating your own cards.
Last modified: 2015-07-24