Get list of installed applications
It is possible to get list of installed applications on device. Sometimes it is very useful feature. You can easily to do it with GetNextApp method of RApaLsSession class with TApaAppInfo structure as parameter. The code sample is below.
ls.GetNextApp(appInfo);
Then you can get all info about application from the TApaAppInfo structure like this below.
appInfo.iUid.iUid; //id of the application
appInfo.iCaption; //caption of the application
appInfo.iFullName //full name of the application
You should use that info according to your application logic. For example you can display name of applications in the list. Sample function code is below. This function is working fine with S60 and Symbian OS v.9.
//gets installed applications
//returns number of installed applications
TInt CMyEngine::AppList()
{
TInt aNum = 0;
RApaLsSession ls;
User::LeaveIfError(ls.Connect());
CleanupClosePushL(ls);
User::LeaveIfError(ls.GetAllApps());
//gets number of installed applications
ls.AppCount(aNum);
TInt Errnono(KErrNone);
TApaAppInfo appInfo;
TInt i=0;
//get list of installed applications
do
{
Errnono = ls.GetNextApp(appInfo);
if (KErrNone == Errnono && appInfo.iCaption.Length())
{
//use those parameters according to
//yours application logic
appInfo.iUid.iUid; //id of the application
appInfo.iCaption; //caption of the application
appInfo.iFullName //full name of the application
}
i++;
}while(KErrNone==Errnono);
CleanupStack::PopAndDestroy(); // ls
return i;
}
Now you can use this function to get information about installed applications and use it according your application logic.