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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

New Contributor
Posts: 6
Registered: ‎03-03-2012
My Device: Playbook
My Carrier: WiFi
Accepted Solution

Is there a way to extend the app exit timeout ?

[ Edited ]

My app needs to save project state upon closing, so I'm handling the NAVIGATOR_EXIT message and starting my save to shared storage then.


The problem is, the project files can be quite large (up to 10Mb) depending on the user content and because the app only has ~500ms to exit before the system forcefully shuts it down, I'm running into cases where the auto-save is failing to complete. I can handle the case of the file not being completely saved when starting up next time, but it means a bad user experience because they will potentially have lost work.


The API reference says an app can call navigator_extend_timeout()  to allow it up to 30s to create its window. I'd like to know if there's an equivalent to extend the forced app closed timout in the same way or something equivalent?


I don't need 30 seconds, just 1-2 more...even if it's running in the background at low priority with no window at that point.


Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Is there a way to extend the app exit timeout ?

I don't believe there's any way to do that, and it wouldn't be something you could rely on anyway. Even the 500ms you're getting now is probably not guaranteed in any way. The design of the system is such that you could get shut down quickly for reasons other than the user terminating your app, and the system may not guarantee you 500ms (or any time) in such cases (e.g. low memory conditions).

You should modify your design to save state incrementally in some fashion rather than all at once and only on exit. There are numerous options, including the simple ones (periodic save), through more complex solutions such as recording a log of changes so that you can "replay" the changes on startup if the app exits suddenly without having a chance to save the full state.

If you can describe the nature of your app and data, others may have helpful suggestions specific to your situation.

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!
Posts: 54
Registered: ‎10-26-2011
My Device: Playbook
My Carrier: Rogers

Re: Is there a way to extend the app exit timeout ?

This is a planned feature as part of BPS.  

It will be coming soon in a future release. 

Please stay tuned!


New Contributor
Posts: 6
Registered: ‎03-03-2012
My Device: Playbook
My Carrier: WiFi

Re: Is there a way to extend the app exit timeout ?

Thanks, even if the app isn't being rendered anymore, a bit of extra time to save/clean-up would be great.