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
Developer
oddboy
Posts: 136
Registered: ‎05-24-2011
My Device: Z30 running 10.2 and Playbook 4GLTE running OS2.1

question about BPS

hey guys,

 

i'm not an expert... i'll admit that upfront.  and this might be a really dumb question...

 

I was looking at the AudioControl example in the NDK examples (and the NetworkStatus one for that matter), and both examples initialize the bps, then go into a while loop waiting for interesting events.  the loop is exited when the NAVIGATOR_EXIT message shows up.

 

the app i'm working on is a C++ class exposed to a QML UI.

 

some features of the app use features that are delivered through the BPS.  others do not require BPS.

 

i'm not totally sure how to go into this while loop to wait for events without affecting the other parts of the app that aren't serviced by BPS.

 

is this just a newb questions (i am a bit of a newb to be honest)?  if i start a while loop as in the examples, will my app get stuck there?

 

thx,

 

oddboy

bron: a cron-like scheduler for BlackBerry 10
http://apps.oddelement.com
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: question about BPS

That particular thread would get stuck there (the term is actually "blocked") until the next BPS event arrived. If you wanted some part of your app to be doing something else, you'd need to create multiple threads beyond the initial one. The initial one actually needs to be the one where the Qt application's event loop runs, however, so you'd need the secondary thread (which you would create) to handle this extra BPS event loop.

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!