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

Web and WebWorks Development

Reply
New Developer
rachna30
Posts: 6
Registered: ‎01-15-2010
My Device: Storm
My Carrier: 900MHz GSM/GPRS networks

findout the OS version and screen size

Hi,

 

i am creating a website for BB Storm and Bold and iphone. I want to use the same HTML's all across with some customization based on the device the site is running on. So, i want to find out the OS version and screen size of the simulator. Any help would be appreciated.

 

Also, i would like to ask if i need to find the OS version and screen size or if there is any othe best way to do this.

 

Thanks,

Rachna

Please use plain text.
Developer
zany
Posts: 222
Registered: ‎11-11-2009
My Device: Storm

Re: findout the OS version and screen size

Hi,

    From the following link you can find the screen size of each device/simultor,

http://docs.blackberry.com/en/developers/deliverables/6625/Dimensions_for_screens_images_and_icons_4...

    Programmatically, it can be found it by calling

       Display.getWidth(), Display.getHeight()

 

  Programmatically, we can idendity the OS version by calling

       DeviceInfo.getSoftwareVersion()

with regards,
Vignesh J

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Don't forget to mark your post as solved if you get the answer and dont forget to give kudos if the answer is useful for you.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Please use plain text.
Administrator
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: findout the OS version and screen size

Hi Rachna,

 

The User-Agent header included in HTTP requests sent by the Browser should contain the handheld software version.  The browser does not include information about screen size.  You could retrieve this screen width & height using JavaScript, and save their values in a cookie.  That cookie could then be sent to your backend server in a web request.

 

Note the browser does include a header named "Profile" in all outgoing HTTP requests.  This header stores the URL of the User Agent Profile file for the device making the request.

 

For example, here is the value of the "Profile" header for requests being made by the browser on a BlackBerry Bold 9000, running version 4.6 OS: http://www.blackberry.net/go/mobile/profiles/uaprof/9000/4.6.0.rdf

 

Open this URL in a browser to see that it is a simple XML file containing lots of information about the given device, including screen size information.  Parsing this file may be another option depending on what information you are looking for in your web application.

 

Sincerely,

Adam

 

 

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.