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

Native Development

Reply
Contributor
madrazoman
Posts: 25
Registered: ‎08-22-2013
My Device: Dev Alpha B
Accepted Solution

Detect if cascades or native on compilation or runtime

Is there a way to detect if the app is being builded (or was built) by native or cascades? I just want to get the screen size like this: http://supportforums.blackberry.com/t5/Native-Development/how-to-get-resolution/td-p/2649643

 

But to select the corresponding function if its native or cascades automatically.

Or does the native one works on cascades also?

 

thanks

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Detect if cascades or native on compilation or runtime

The native approach would work, but there's no need to use it or to identify whether the app is native or Cascades...

 

Just use this in Cascades: https://developer.blackberry.com/native/reference/cascades/bb__device__displayinfo.html


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Contributor
madrazoman
Posts: 25
Registered: ‎08-22-2013
My Device: Dev Alpha B

Re: Detect if cascades or native on compilation or runtime

[ Edited ]

So, the answer is "no"?

Suppose that it is a dll, I mean ".so",  and I dont know beforehand if it will be linked to native or cascades.

Or is there an environment variable (windows) that is set for cascades to determine which version to link to?

Also, if I can confirm that the "native" approach works with cascades, it would solve my issue :smileyvery-happy:

Thanks 

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Detect if cascades or native on compilation or runtime

Cascades just builds on the native stuff. All the native stuff is still available in a Cascades app. Think of it as a superset of the available APIs.

In any case, that post wasn't a "no", it was one of many different "yeses" which apply. I was trying to keep it simple because I don't understand half of what you're asking... you didn't mention a loadable library at first, and "(windows)" looks sort of out of place considering the context here. Was that use of "windows" related to Microsoft's OS, or something else?

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Contributor
madrazoman
Posts: 25
Registered: ‎08-22-2013
My Device: Dev Alpha B

Re: Detect if cascades or native on compilation or runtime

[ Edited ]

Thanks. Now I understand that the only difference between cascades and "core" is the addition of some libraries when compiling. This clearify my question.