Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Native Development

Reply
Developer
peter9477
Posts: 3,831
Registered: 12-08-2010
My Carrier: none
Accepted Solution

Minimalist app is getting terminated after 30s... why?

What are the minimal actions which an app must take in order to be allowed to stay running?

 

As a learning exercise and to assist with testing something, I've tried writing a nearly function-less app (as in, performs no function... not "doesn't call any functions").

 

It launches with a nice white screen (provided by the OS, I suppose, since I don't render anything) and sits there for 30s, blocking on a low-level event of some kind (not even the BPS event stuff... just raw posix).

 

After 30s, the OS kills the process.

 

Any idea why?  What does an app have to do to be allowed to live for longer?  Calling bps_initialize() is not sufficient... tried that. 

 

Does it have to create a screen context?  Request any type of events and start receiving them with a get_event() call?  Or something else?

 

(I vaguely recall Elena making a comment about AIR apps needing to do something within some timeout or they'd be killed, but I don't recall what it was and can't find the thread.)


Peter Hansen -- (PlayBook and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru | Get more from your battery! Power, voltage, life.
Please use plain text.
BlackBerry Development Advisor
cdamus
Posts: 45
Registered: 10-25-2010
My Carrier: Rogers

Re: Minimalist app is getting terminated after 30s... why?

All applications (AIR, Native, whatever) must create and present a window within 30 seconds.  Otherwise, the system assumes the app has failed to start correctly and will kill it.

 

The basic assumption is that apps exist to present some interactive behaviour to users. :-)

Please use plain text.
Developer
peter9477
Posts: 3,831
Registered: 12-08-2010
My Carrier: none

Re: Minimalist app is getting terminated after 30s... why?

Thanks Christian, can you narrow that down a bit more for us?

I assume it's not enough just to create a screen context then. Is it sufficient to do screen_create_window(), or do you need more. I suspect the latter, as I see the following in the docs. Is it sufficient to do what it says there then, i.e. posting just the first frame?

"The window will not be visible until at least one buffer has been created with screen_create_window_buffers() and until one frame has been posted with screen_post_window()"

Peter Hansen -- (PlayBook and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru | Get more from your battery! Power, voltage, life.
Please use plain text.
BlackBerry Development Advisor
elena_laskavaia
Posts: 406
Registered: 10-27-2010

Re: Minimalist app is getting terminated after 30s... why?

Please use plain text.
Developer
peter9477
Posts: 3,831
Registered: 12-08-2010
My Carrier: none

Re: Minimalist app is getting terminated after 30s... why?

Beautiful! Thanks Elena and Christian. :smileyhappy:

Peter Hansen -- (PlayBook and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru | Get more from your battery! Power, voltage, life.
Please use plain text.
BlackBerry Development Advisor
elena_laskavaia
Posts: 406
Registered: 10-27-2010

Re: Minimalist app is getting terminated after 30s... why?

Technically it is not minimal because it also uses navigator connection, but if you don't connect to navigator you won't recive life-cycle events which is less than ideal

Please use plain text.