×
Namespaces

Variants
Actions
Revision as of 10:00, 11 January 2012 by hamishwillee (Talk | contribs)

How to discover all installed applications

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia 5800
Article
Created: symbianyucca (20 Mar 2007)
Last edited: hamishwillee (11 Jan 2012)

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;
}

If you are interrested only in not hidden applications you may want to add some code like:

        //Get app capabilities
TApaAppCapabilityBuf capability;
User::LeaveIfError(ls.GetAppCapability(capability, AppInfo.iUid));
if (capability().iAppIsHidden)
{
//Don't show hidden apps
continue;
}

To get application list change notifications take a look at CApaAppListNotifier from apgnotif.h.


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.

64 page views in the last 30 days.
×