Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

How to uninstall themes programmatically

From Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): S60
Platform(s): Symbian
S60 5th Edition
Keywords: RAknsSrvSession EnumerateSkinPackagesL CAknsSrvSkinInformationPkg RSisRegistrySession InstalledPackagesL CSisRegistryPackage RSWInstLauncher CustomUninstall SilentCustomUninstall
Created: chenziteng (27 Mar 2010)
Last edited: kiran10182 (29 Jun 2011)



1. The RAknsSrvSession and CAknsSrvSkinInformationPkg are parts of the Extended Skins API included in the SDK API Plug-in

2. The RSWInstLauncher is part of the SW Installer Launcher API which is also included in the SDK API Plug-in

3. The RSisRegistrySession and CSisRegistryPackage are Symbian/S60 internal API, for commercial use please join the S60 API Partnering Program and purchase it from Nokia.


The Wiki article together with a full example shows how to implement the following use case: the application lists all the themes (also called skins) and allows the user to select to remove them.


1. The application uses RAknsSrvSession::EnumerateSkinPackagesL() to enumerate all the themes, and then populate a list-box with the themes' info, for example in the following example the theme names are added to the list-box one by one.

TInt err = iAknsSrvSession.Connect(this); // connect to the AVKON skin server
if(iAknsSrvSkinInformationPkgs!=NULL) // clear the skin info packages array
delete iAknsSrvSkinInformationPkgs;
iAknsSrvSkinInformationPkgs = NULL;
CTextListBoxModel* model = iListBox->Model();
CDesCArray* itemArray = static_cast< CDesCArray* > ( model->ItemTextArray() );
itemArray->Reset(); // clear the listbox
iAknsSrvSkinInformationPkgs = iAknsSrvSession.EnumerateSkinPackagesL(EAknsSrvAll); // fetch the latest skin info packages
TInt count = iAknsSrvSkinInformationPkgs->Count();
for(TInt i=0;i<count;i++)
const CAknsSrvSkinInformationPkg& pkg = *((*iAknsSrvSkinInformationPkgs)[i]);
TBuf<512> listString;
CreateListBoxItemL( listString, pkg.Name()); // add the theme name to the listbox
AddListBoxItemL( iListBox, listString );

2. When the user chooses a theme from the list-box and then selects to remove it, the application first calls RSisRegistrySession::InstalledPackagesL() to enumerate all the installed packages (sis, jar etc.), and then compares one by one the package name (CSisRegistryPackage::Name) with the selected theme name (CAknsSrvSkinInformationPkg::Name), if any match is found then it is the theme package we are looking for. After knowing the sis registry information especially the UID, the application finally can call RSWInstLauncher::CustomUninstall() to uninstall the theme.

TInt index = iListBox->CurrentItemIndex(); // get the index of the user selected theme
const CAknsSrvSkinInformationPkg& pkg = *((*iAknsSrvSkinInformationPkgs)[index]); // get the theme's info
TUid uid = KNullUid;
Swi::RSisRegistrySession session;
TInt err = session.Connect(); // connect to the sis registery server
RPointerArray<Swi::CSisRegistryPackage> sisPkgs;
session.InstalledPackagesL(sisPkgs); // get all the installed packages (sis, jar, etc.), capability ReadUserData is required
TInt count = sisPkgs.Count();
for(TInt i=0;i<count;i++)
Swi::CSisRegistryPackage& sisPkg = *(sisPkgs[i]);
// is it the sis package for the theme?
uid = sisPkg.Uid(); // if yes then remember its UID and index
index = sisPkg.Index();
SwiUI::RSWInstLauncher installer;
User::LeaveIfError( installer.Connect() );
CleanupClosePushL( installer );
SwiUI::TOpUninstallIndexParam params;
params.iUid = uid;
params.iIndex = index;
SwiUI::TOpUninstallIndexParamPckg pckg( params );
SwiUI::TOperation operation( SwiUI::EOperationUninstallIndex );
SwiUI::TUninstallOptions uninstallOptions;
SwiUI::TUninstallOptionsPckg optPckg( uninstallOptions );
err = installer.CustomUninstall( operation, pckg,SwiUI::KSisxMimeType() ); // now remove the theme package
// silent uninstall can also be used.
// err = installer.SilentCustomUninstall( operation, optPckg, pckg,SwiUI::KSisxMimeType() );
if(err!=SwiUI::KSWInstErrUserCancel) // if user interaction is needed then user may cancel the uninstallation
CleanupStack::PopAndDestroy( &installer );


Full example: GoodbyeHell(UninstallSelectedTheme).zip

A copy of the necessary headers/libraries from the the SDK plug-in and Symbian PDK is included in the example so that it can be built with S60 5th Edition SDK. The example has been tested on both S60 5th Edition emulator and a device but it is just for demonstration purpose and no guarantee of stability/compatibility.

How to use:

1. Install a theme on target (for example the aquarius multicolor)

2. Install the GoodbyeHell(UninstallSelectedTheme).zip\GoodbyeHell\sis\GoodbyeHell.sisx

3. Start the app and you will see all the themes are listed, select the installed theme and then select "Options"->"Uninstall", then follow the prompt to uninstall the theme.


SDK API Plug-in

Extended Skins API

SW Installer Launcher API

This page was last modified on 29 June 2011, at 08:02.
71 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.