Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Trusted Contributor
Posts: 224
Registered: ‎08-11-2010
My Device: Not Specified
Accepted Solution

How to determine if device supports portrait / landscape views ?

Is there an easy way to determine if device screen supports portrait / landscape views ? 

(We need this in order to provide different settings to user)

 

Until recently we used check similar to this one:

 

if OS >= "6.0" && AccelerometerSensor.isSupported()

 

but this code fails on the new Bold  9900 (which has  Accelerometer, but does not have landscape mode).

 

We are looking for solution which does not invlove checking device models manually ...

 

Thanks in advance ! 

 

 

 

 

Developer
Posts: 543
Registered: ‎12-23-2010
My Device: Z10
My Carrier: Airtel

Re: How to determine if device supports portrait / landscape views ?

Hi ,

 

Generally the devices which support TouchScreen are have both the modes.

So that you can go with TouchScreen.isSupported()

 

Thanks.

Trusted Contributor
Posts: 224
Registered: ‎08-11-2010
My Device: Not Specified

Re: How to determine if device supports portrait / landscape views ?

> So that you can go with TouchScreen.isSupported()

 

Does not work - example Bold 9900 

Developer
Posts: 543
Registered: ‎12-23-2010
My Device: Z10
My Carrier: Airtel

Re: How to determine if device supports portrait / landscape views ?

Then you can try with both the combinations of screen resolution and TouchScreen.isSupportrd().
Trusted Contributor
Posts: 224
Registered: ‎08-11-2010
My Device: Not Specified

Re: How to determine if device supports portrait / landscape views ?

> Then you can try with both the combinations of screen resolution and TouchScreen.isSupportrd().

 

Thank you for your continiues offer to help us.

 

Do you have in mind a reliable solution which will work on current set of BlackBerry devices and (hopefully) new models ?  

 

On first glance your suggestions is much worse then checking device model directly.

Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to determine if device supports portrait / landscape views ?

don't know a solution myself, and as it is a good question i've escalated it.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
BlackBerry Development Advisor
Posts: 15,264
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: How to determine if device supports portrait / landscape views ?

You can use the DeviceCapability.isRotationSupported() method to determine this.  This class was added in BlackBerry Device Software version 6.0.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 264
Registered: ‎10-05-2010
My Device: Not Specified

Re: How to determine if device supports portrait / landscape views ?

Is there a workaround to do this for OS5? What are the underlying parameters that the OS6 API polls?

Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to determine if device supports portrait / landscape views ?

as all acceleratometer devices with 5.0 support it there is no need for a separate check.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Highlighted
Developer
Posts: 264
Registered: ‎10-05-2010
My Device: Not Specified

Re: How to determine if device supports portrait / landscape views ?

Except that some later devices do not. e.g. 9900. So a check is needed.

 

I'm trying to avoid building apps for specific devices and OSs. I want to build to a minumum OS and let later devices use that. It's a lot less work.