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
Contributor
Posts: 30
Registered: ‎12-18-2012
My Device: BB Z10, BBQ10 Dev Alpha C
My Carrier: xyz
Accepted Solution

How to target BB Q10

Hi guys

 

I'm trying to optimize my app for Blackberry Q10. My question is how to detect the model name of device?

I could not find any API function to deal with it.

 

I don't want to insert two different apps into App World, for Z10 and Q10, but rather just one which can serve different layouts (I know, possible with css) and functions.

 

Thanks in advance

-------------------------
@oggyindahouse
Contributor
Posts: 38
Registered: ‎03-07-2012
My Device: Dev Alpha B, Playbook 16GB, Z10 LE
My Carrier: Bell Canada

Re: How to target BB Q10

I'd like to know what the recommended approach is as well.

 

Thanks

DM

------------
"The shortest answer is doing." - Jacula Prudentum
My app: Cashalyst
Highlighted
Retired
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: How to target BB Q10

Hey guys,

 

From our experience internally the best way to lay things out developing for WebWorks is to use the Cascading properties of CSS. What I mean by that is this:

 

1. Include any common styling you have in your CSS files as you normally would, you can base it off your L version.

 

2. If you need to optimize certain elements for certain screen resolutions then include only those parts that need updates further down in your CSS file. You can use the following media query to detect the Q10 size screen:

 

@media screen and(device-height:720px)and(device-width:720px){

#myElement {

height: <updatedHeight>;

}

div.elem {

width: <newWidth>;

}

....

....

}

 

This way you should only have a small diff, and keep an application that can run on both resolutions.

I hope this helps Smiley Happy.

 

 

@erikjohnzon
erjohnson@blackberry.com
Contributor
Posts: 30
Registered: ‎12-18-2012
My Device: BB Z10, BBQ10 Dev Alpha C
My Carrier: xyz

Re: How to target BB Q10

Thanks but I need also new functions specifically for Q10, as I described above in my post. Probably there is no way to detect the device model.

-------------------------
@oggyindahouse
Retired
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: How to target BB Q10

Apologies. So you want to actuall insert different functions? No, we don't expose an API yet. You can use the window.screen.height and the window.screen.width to detect the screen height. Perhaps create your own module that exposes the device model.

@erikjohnzon
erjohnson@blackberry.com
Contributor
Posts: 30
Registered: ‎12-18-2012
My Device: BB Z10, BBQ10 Dev Alpha C
My Carrier: xyz

Re: How to target BB Q10

good idea!

Thanks

-------------------------
@oggyindahouse
Retired
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: How to target BB Q10

This could be an all JS extension. You could then push it back to the community repos for others to use. Let me know if you need any help with it.

 

https://github.com/blackberry/WebWorks-Community-APIs/tree/master/BB10

@erikjohnzon
erjohnson@blackberry.com
Developer
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: How to target BB Q10

[ Edited ]

Nobody answered the first line of the Q - how to know its a Q10

 

I just tried this on SDC Sim

 

	msg= "Hi from Q10 Test<br />\n<br />\n" +
		 "HWID = " + blackberry.system.hardwareid + "<br />\n" +
		 "Lang = " + blackberry.system.language + "<br />\n" +
		 "Name = " + blackberry.system.name + "<br />\n" +
		 "Regn = " + blackberry.system.region + "<br />\n" +
		 "SWVr = " + blackberry.system.softwareVersion + "<br />\n";

 

Being a simulator I got garbage out

 

Can someone with a DA. a Canadian with an LE or, preferably, a BB Bod with a Q10 (no device - don't we love BrandAlliance...) try the same out to give us an idea what we get?

 

Hi from Q10 Test

 

HWID = undefined

Lang = en-US

Name = ?

Regn = en-US

SWVr = 10.1.0.338

 

 

 




Click the like button if you find my posts useful!
Retired
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: How to target BB Q10

From above: "No, we don't expose an API yet."

 

This got missed, is forthcoming with the next release of WW. We will have communication which will clarify. But you will be able to get the model as Q10 or Z10 and more properties which we have now plummed in.

@erikjohnzon
erjohnson@blackberry.com
Developer
Posts: 123
Registered: ‎02-13-2012
My Device: Z10 LE
My Carrier: Mobistar

Re: How to target BB Q10

I don't want to insert two different apps into App World, for Z10 and Q10, but rather just one which can serve different layouts (I know, possible with css) and functions.

 Why don't you submit 1 app into App World and in the release add 1 filebundle for Z10 and another for Q10, it's not that hard.

Please click the like button if my post helped you! Thank you.