Friday, April 04, 2008

How to handle Foreground / Background events

The application framework calls CCoeAppUI::HandleForegroundEventL() when the application is switched to the foreground or background. While the default implementation of this method is empty, it can be, for example, used to display messages or pause a game when a focus change event occurs.

Example:

void CMyViewAppUi::HandleForegroundEventL(TBool aForeground)
{
if (aForeground==TRUE)
{
iEikonEnv->InfoMsg(_L("Foreground true"));
}
else
{
iEikonEnv->InfoMsg(_L("Foreground false"));
}
}


Note: The aForeground parameter is true if the application is switched to the foreground (is visible) and false if the application has gone to the background.

No comments:

stats counter