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
New Contributor
RejP
Posts: 6
Registered: ‎03-03-2012
My Device: Playbook
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.

 

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

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!
Please use plain text.
BlackBerry Development Advisor
anhu
Posts: 54
Registered: ‎10-26-2011
My Device: Playbook

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!

 

Please use plain text.
New Contributor
RejP
Posts: 6
Registered: ‎03-03-2012
My Device: Playbook

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.

Please use plain text.