RApaLsSession can be used to get all currently installed applications from the device. The following code sample shows how to get an array containing names of the installed applications:
Headers:
#include <APGCLI.H>
#include <BADESCA.H>
Link against:
LIBRARY apgrfx.lib
LIBRARY bafl.lib
CDesCArray* CMyClass::GetApplicationsLC()
{
const TInt KArrGranularity = 10;
CDesCArrayFlat* MyArray = new(ELeave) CDesCArrayFlat(KArrGranularity);
CleanupStack::PushL(MyArray);
RApaLsSession ls;
User::LeaveIfError(ls.Connect());
CleanupClosePushL(ls);
User::LeaveIfError(ls.GetAllApps());
TInt ErrnoNo(KErrNone);
TApaAppInfo AppInfo;
do
{
ErrnoNo = ls.GetNextApp(AppInfo);
if(ErrnoNo == KErrNone && AppInfo.iCaption.Length())
MyArray->AppendL(AppInfo.iCaption);
} while(ErrnoNo == KErrNone);
CleanupStack::PopAndDestroy(); // ls
return MyArray;
}
TApaAppInfo also has many other information items of the application that can be utilized when airing application information, for example Get application icon shows how to get the application icon using the application UID that van be retrieved using the code sample shown above.
No related wiki articles found