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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Adobe AIR Development

Reply
Trusted Contributor
Vibes
Posts: 139
Registered: ‎03-14-2012
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

Please use plain text.
New Contributor
Hattie_pl
Posts: 9
Registered: ‎01-14-2013
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 

}

}

 

Please use plain text.
Developer
jtegen
Posts: 6,234
Registered: ‎10-27-2010
My Carrier: AT&T

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;

Please use plain text.
Trusted Contributor
Vibes
Posts: 139
Registered: ‎03-14-2012
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?

 

 

Please use plain text.
Developer
jtegen
Posts: 6,234
Registered: ‎10-27-2010
My Carrier: AT&T

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
Please use plain text.