How to detect if application launched from Home-screen
This article explains how to detect if the application has been launched from Home-Screen or Menu.
Sometimes when you create an application you want it to do a specific action when user launches it from Home-Screen, and to do another action when user launches it from menu.
TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindByPos(1);
TInt WgId = task.WgId();
CApaWindowGroupName* wgn = CApaWindowGroupName::NewLC(CEikonEnv::Static()->WsSession(), WgId);
TUid uid = wgn->AppUid();
if (uid == TUid::Uid(0x102750F0)) // HomeScreen UID
// Launched from Homescreen
// Launched from Menu
For example, if you create a memory cleaner application you may want user to add a shortcut of your application on Home-Screen to clean memory with one simple touch / click, and if user wants to access your application to select manually specific actions to clean memory, he / she has to launch your application from Menu.