Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Keeping a Symbian application running in the background on exit

From Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia N95
Nokia N96
Nokia E72
Compatibility
Platform(s): S60 5th Edition
S60 3rd Edition, FP1
S60 3rd Edition, FP2
S60 3rd Edition FP2
S60 3rd Edition FP1
S60 3rd Edition (initial release)
Article
Keywords: CApaWindowGroupName, HideApplicationFromFSW
Created: User:Kbwiki (23 Mar 2014)
Last edited: hamishwillee (24 Aug 2012)

Description

There are instances where some time-consuming operations need to be done during application exit. To avoid unneccessary delays and improve usability, an application can be switched to the background and hidden from the task list/fast-swap window once user interaction is no longer required.

Note.pngNote: For a better user experience: If you 'Set' the 'Exit' button in your project to 'Hide' your application rather than shutting it down; You are advised to show a note informing the user that your application is running in the background and not entirely closed.

Solution

The application can be hidden and made to run in the background using the below code in the implementation of the AppUI class.

 #include <apgwgnam.h>    // link against apgrfx.lib
#include <w32std.h> // link against ws32.lib
 
 
CMyAppUi::HandleCommandL( TInt aCommand )
{
switch( aCommand )
{
case EEikCmdExit:
case EAknSoftkeyExit:
{
CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC(
iEikonEnv->WsSession(),
iEikonEnv->RootWin().Identifier() );
wgName->SetHidden( ETrue );
wgName->SetWindowGroupName( iEikonEnv->RootWin() );
 
// Hide the application from fast-swap window
// CAknAppUi::HideApplicationFromFSW() is available
// from S60 3rd Ed, FP1 onwards
HideApplicationFromFSW( ETrue );
 
// Send this application to background
iEikonEnv->RootWin().SetOrdinalPosition( -1 );
 
CleanupStack::PopAndDestroy( wgName );
 
// Proceed to do cleanup and call Exit() when done.
break;
}
...
This page was last modified on 24 August 2012, at 00:03.
94 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×