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.
Article Metadata
Tested with
Devices(s): Nokia E7
Compatibility
Platform(s): Symbian^3, Symbian Anna
Device(s): All Symbian^3
Article
Created: ashraf fawzy
(09 Feb 2012)
Last edited: ashraf fawzy
(17 Aug 2012)
Introduction
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.
Note: This method doesn't work on Nokia Belle, as Both Home-screen and Applications Menu has the same UID.
Code Example
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();
CleanupStack::PopAndDestroy();
if (uid == TUid::Uid(0x102750F0)) // HomeScreen UID
{
// Launched from Homescreen
}
else
{
// Launched from Menu
}
Summary
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.


(no comments yet)