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.

Password Protected Symbian application uninstall

From Wiki
Jump to: navigation, search
Article Metadata
Code ExampleCompatibilityArticle
Created: vdharankar (06 Dec 2009)
Last edited: hamishwillee (25 Jul 2012)


How to password protect uninstallation of Symbian application

This topic has been discussed in DIBOs number of times, so I decided to write a formal description of the
method which will discuss the requirements to protect the uninstallation of a Symbian application with an example.


Few basic things needs to be understood to write such an application before it is fully coded.


Whenever such application is to be written basic idea needs to be understood. The logic is quite simple though. The application which is to be protected against an unauthorized uninstall should have a mechanism to show user-interface which will ask for password. When user enters password it will be checked and if found incorrect the process of uninstall will be interrupted. This whole logic needs to be provided by user application. As Symbian installer doesn't provide any facility for this.


The uninstall can be certainly stopped but as the method is being discussed is not standard, Symbian-signed may raise an issue while express signing your application(I am not sure as I have never sent my application to Symbian-signed with this logic in it). Also sometimes Symbian installer shows confirmation dialog to user when the installation is interrupted because of wrong password, but nothing to worry in all case if you interrupt and stop uninstall it will be stopped.

The application needs to be signed with developer certificate to test on device. Such applications can not be tested in emulators and needs to have appropriate capabilities while signing.

The Concept

The basic idea behind developing such an application is as follows.

 1) Run the application and ask for password every time user tries to uninstall it.

The above use case can be satisfied using "RR" option provided by Symbian installer. This options needs to be added to the package file. In case of the example presented it was added as follows

 "$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\UninstalDemo.exe"		-"!:\sys\bin\UninstalDemo.exe",RR,RW

Replace exe file name with yours of course.

 2) Create UI for password authentication and present it to the user when application runs at the time of uninstall.

The above use case can be satisfied by adding the code to the application as follows. In the APPUI class of the application inside InitializeContainersL() method add the logic to check, if the application has be launched by uninstall process or the user. If the application has be launched by uninstaller then the UI to accept password and rest of the logic is to be added.

        const TUid KInstallerUidin3rdEd = {0x101f875a};
RWsSession& wsSession = CEikonEnv::Static()->WsSession();
TApaTaskList taskList(wsSession);
TApaTask aTask = taskList.FindApp(KInstallerUidin3rdEd);
SetDefaultViewL( *iPasswordView );
SetDefaultViewL( *iUninstalDemoContainerView );

The code fragment shows the logic to detect if the installer is running.

  const TUid KInstallerUidin3rdEd = {0x101f875a};

The above line is the UID of installer process. Using UID, it can be checked if that process is running and based on result the view can be switched.

 3) If user enters invalid password then terminate the installer to stop uninstall.

The above use case can be realized as follows


Simply terminate the installer process when user enters the password which is invalid. To get the handle of the process the above mentioned code can be used.

 4) If the password entered is correct exit the application

Above use case is crucial for successful uninstall of the application, because the installer will not be able to proceed further untill the application is closed.

The Example

The example which demonstrates the whole idea is called as UninstallDemo attached as a file with this article. This example has a main application view which does nothing, and the second view or container which shows password box to the user when application is being uninstall.


If the password entered is incorrect then the uninstall is stopped.


Signing Application

The application with this functionality needs to be signed with at least a developer certificate. The demo source code needs to be signed with a developer certificate. For this example following capabilities are required.


The Source Code

More links on the same topics

[Discussion thread on same topic]

This page was last modified on 25 July 2012, at 05:39.
48 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.