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

Adobe AIR Development

Reply
Developer
Posts: 236
Registered: ‎03-14-2012
My Device: PlayBook 2.0
My Carrier: AT&T

How to find out on what kind of device an app is running?

Hi,

 

what's the best method to find out on what device an Air app is running?

(I need to change the button sizes on devices like the dev alpha)

 

Thanks

Vibes

Highlighted
New Contributor
Posts: 9
Registered: ‎01-14-2013
My Device: 9320
My Carrier: Orange PL

Re: How to find out on what kind of device an app is running?

Hello
Check this solution

 

//start app
public function Main(){ 

checkDevice();

}

//check stage size
public function checkDevice(){


if(stage.stageWidth == 768 && stage.stageHeight == 1280){

myButton.width = 768; //// Dev Alpha

}

if(stage.stageWidth == 1024 && stage.stageHeight == 600){

myButton.width = 1024; /// Playbook 

}

}

 

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to find out on what kind of device an app is running?

[ Edited ]

Capabilities.pixelAspectRatio;
Capabilities.screenDPI;
Capabilities.os;
Capabilities.screenResolutionX;
Capabilities.screenResolutionY;

I'm going to assume DPI is probably the best value to look at. the others might be useful too.

 

Found in:

import flash.system.Capabilities;

Developer
Posts: 236
Registered: ‎03-14-2012
My Device: PlayBook 2.0
My Carrier: AT&T

Re: How to find out on what kind of device an app is running?

Is the screenDPI of the BlackBerry10 devices all the same or are they different?

 

 

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to find out on what kind of device an app is running?

It should be very close. But until we have a device on hand, one cannot be certain. If you are setting assets based on the DPI, I sould give it some kind of range/buffer. For example:
IF DPI > 150 THEN
ENDIF