You Can bring your application in Foreground or send application to the Background

To Bring you application foreground just use this lines of code:

/*0xEBD12EE4 is application uid*/

TUid KMyAppUid = {0xEBD12EE4};
TApaTaskList taskList(CCoeEnv::Static()->WsSession());
TApaTask task = taskList.FindApp(KMyAppUid);
if (task.Exists())
{
task.BringToForeground();
}

To send application to the background just use

task.SendToBackground() 

instead of

task.BringToForeground()

N.B. This code is tested on NOKIA S60 3rd Edition FP1 Device (E51)