Thursday, August 02, 2007

How to launch an application with its UID

LaunchAppWithUIDL(const TUid aAppUid)
{
RApaLsSession apaLsSession;
User::LeaveIfError(apaLsSession.Connect());
CleanupClosePushL(apaLsSession);

TApaAppInfo appInfo;
TInt retVal = apaLsSession.GetAppInfo(appInfo, aAppUid);

if(retVal == KErrNone)
{
CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
//cmdLine->SetLibraryNameL(appInfo.iFullName); // Pre Symbian V9
cmdLine->SetExecutableNameL(appInfo.iFullName);
cmdLine->SetCommandL(EApaCommandRun);
User::LeaveIfError( apaLsSession.StartApp(*cmdLine) );

CleanupStack::PopAndDestroy(cmdLine);
}
else
{
// Application with UID can't be found!
}

CleanupStack::PopAndDestroy(&apaLsSession);
}

No comments:

stats counter