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
abx
Contributor
abx
Posts: 26
Registered: ‎10-03-2012
My Device: Playbook

Active channel and standby

[ Edited ]

My app comprises of two threads.  One has the main event handler which simply listens for events on the active channel.  The second does bps_channel_push_event to push user events on this channel.  I store the channel id in a global, g_Channel.

 

This works most of the time, i.e. I can push user events from thread 2 and receive them on the first thread.   However, when I click standby button (power button) and return to the app, sometimes user events stop working.    Is it possible the active channel has changed after coming back from standby?   Do I need to recheck the active channel id?    Can you think of any reasons for this odd behaviour?

 

 

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

Re: Active channel and standby

Is it possible the new <permission>run_when_backgrounded</permission> is what you need to get the desired behaviour? I haven't seen specifics of the various ways in which NOT having that will affect apps built with the various SDKs, but for all non-native ones (at least) it's now required that you specify that if you want your app to continue processing at all in standby (or, indeed, even when minimized).

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!
BlackBerry Development Advisor
jhoffmann
Posts: 38
Registered: ‎10-26-2011
My Device: BlackBerry Bold 9900

Re: Active channel and standby

Is this on PlayBook or BB10 Dev Alpha?

abx
Contributor
abx
Posts: 26
Registered: ‎10-03-2012
My Device: Playbook

Re: Active channel and standby

Funny you should mention run_when_backgrounded.   When the user presses standby I suspend my threads explicitely (i will call this user_suspend).   Is it possible before I have a chance to suspend properly, the system will suspend my threads (i will call this system_suspend)? 

 

This would mean that when it system_resumes, it will leave where it left off which is to enter my app's user_suspended state.   Seems like possible race condition.

abx
Contributor
abx
Posts: 26
Registered: ‎10-03-2012
My Device: Playbook

Re: Active channel and standby

[ Edited ]

Playbook 2.1 though we have started to see similar issues with the 10.0.9 firmware update on alpha