How to get a list of all apps installed on a Symbian device
Article Metadata
Tested with
Devices(s): All (Symbian OS)
Compatibility
Platform(s): S60, Series 80
Article
Keywords: RApaLsSession::GetAllApps()
Created: User:Technical writer 2
(June 9, 2005, updated October 21, 2008)
Last edited: hamishwillee
(14 Jun 2012)
Description
The following code creates a text file containing a list of all applications and their UID values. It can be run on any Symbian OS phone.
Solution
#include <f32file.h> // link against efsrv.lib
#include <apgcli.h> // link against apgrfx.lib, apparc.lib
_LIT(KFileName, "c:\\applications.txt");
const TInt KMaxSize = 512;
LOCAL_C void WriteAppInfoToFileL()
{
RFs fs;
RFile file;
RApaLsSession lsSession;
// Connect to file server
User::LeaveIfError( fs.Connect() );
CleanupClosePushL( fs );
// Connect to application architecture server
User::LeaveIfError( lsSession.Connect() );
CleanupClosePushL( lsSession );
// Open (replace if exists) the file for writing
file.Replace( fs, KFileName, EFileWrite | EFileStreamText );
CleanupClosePushL( file );
TApaAppInfo appInfo;
TBuf<KMaxSize> buf;
TBuf8<KMaxSize> fileBuf;
// Get info on all apps, then iterate through each app
// and write its info (caption, name, uid) to file
lsSession.GetAllApps();
while( lsSession.GetNextApp( appInfo ) == KErrNone )
{
buf.Zero();
buf.AppendNum( (TUint)aInfo.iUid.iUid, EHex );
buf.Append( _L("\t") );
buf.Append( appInfo.iCaption );
buf.Append( _L("\t") );
buf.Append( appInfo.iFullName );
fileBuf.Copy( buf );
fileBuf.Append( _L("\n") );
file.Write( fileBuf );
}
CleanupStack::PopAndDestroy( 3 ); // file, lsSession, fs
}


One small bug:
If application UID begin with char (a/b/c/d/e/f) then output UID printed to file begin with "ffffffff" prefix.
Example, original uid e602d449 - in file we have ffffffffe602d449
Solution:
replace
buf.AppendNum(aInfo.iUid.iUid, EHex);
with
buf.AppendNum((TUint)appInfo.iUid.iUid, EHex);