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
Posts: 207
Registered: ‎02-10-2011
My Device: Playbook 16GB and Z10
My Carrier: Verizon

Correct ways to manually end app

[ Edited ]

I was looking at the Fundamentals of Cascades and it lists 2 options for ending an app, either automatically or manually.

 

But I think it would also be beneficial to list that clean up can also be done in ~App();

 

Am I wrong in thinking that would be a good place to do clean up?  Isn't that called after quit()?

_________________________________________________
Apps
Go Music
Flashlight Fast Free/Pro
Fitbit for BlackBerry PlayBook
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Correct ways to manually end app

You could do some cleanup there, but it would occur only after the application main loop had terminated, and you'd basically have no ability to do anything asynchronous, you couldn't use QThreads or communicate with any other process or thread, and you'd basically have few options left for what you could actually do.

The intention of the aboutToQuit() or manualExit() approach is that it gives you a chance to do work while the Application object is still functional and running its event loop. With the manualExit() approach, you could even extend the termination timeout indefinitely, giving you a chance to finish some remote process (e.g. communicating with a server) if required.

There's no single best solution though... use what works for you. I'd prefer to do my important "cleanup" (saving app state etc) while the whole Cascades/Qt machinery was still available to me, so I'm typically using manualExit() across the board at this point, for greatest control.

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!