Namespaces
Variants
Actions

Keeping a Symbian application running in the background on exit

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

Article
Keywords: CApaWindowGroupName, HideApplicationFromFSW
Created: User:Kbwiki (23 Mar 2013)
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.png
Note: 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 03:03.
336 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved