Detect the uninstall event inside the application
Article Metadata
Following information is correct for shutting down of system, not for uninstalling. I found some pointers which suggest that there is no way that we can get uninstall event. I also tried following code, but didn't get any event.
It is possible to find the uninstall or abnormal exit of an application from inside your application if you are using the Symbian application framework. You have to override the CCoeAppUi::HandleSystemEventL(const TWsEvent &aEvent) to your AppUi class. Whenever a system event is generated, this function will get invoked. The paramerter aEvent will give you more information. Now check the following code, which is used to detect the uninstall event of an application.
void CMyAppUi::HandleSystemEventL(const TWsEvent& aEvent)
{
TApaSystemEvent systemEvent = *(TApaSystemEvent*)aEvent.EventData();
switch(systemEvent)
{
case EApaSystemEventShutdown:
// TODO: Do what ever is necessary here.
// An example would be authenticate the user.
// and if the authentication got succeed call
// HandleCommandL(EEikCmdExit)
break;
default:
break;
}
}


You can specify that an executable be run during an installation by adding FILERUN (FR)and RUNINSTALL (RI) keywords at the end of the executable’s file specification line. For example: "\Symbian\6.1\Series60\Epoc32\release\armi\urel\myprogram.exe"- "!:system\programs\myprogram.exe",FR,RIwill install myprogram.exe and execute it during the installation. The RUNINSTALL keyword can be replaced by either of the following alternatives: • RUNREMOVE (RR) causes execution to occur only during uninstallation. • RUNBOTH (RB)causes the executable to be run on both installation and uninstallation. Any of these three options may be further qualified by use of the RUNWAITEND (RW) keyword, which causes the installation to wait for the executable to complete before continuing. If not specified, then installation continues immediately after the executable is launched. Advanced Package File Options