symbian 静默安装与静默删除 - [symbian]
2010-03-26
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明http://iovi.blogbus.com/logs/61145043.html
这几天做主题管理用到了这个问题,现在贴出来
首先必须使用非公开的API
"SDK API Plug-in"
http://wiki.forum.nokia.com/index.php/SDK_API_Plug-in
http://wiki.forum.nokia.com/index.php/SDK_API_Plug-in
"Wiki: Extended Skins API"
http://wiki.forum.nokia.com/index.php/Extended_Skins_API
http://wiki.forum.nokia.com/index.php/Extended_Skins_API
下面是安装,可以同步,也可以异步,下面这个是同步,异步的话还要自己写一个AO。
// Silent Installer
SwiUI::RSWInstSilentLauncher iLauncher;
//Install Option
SwiUI::TInstallOptions iOptions;
//Installation Option pkg
SwiUI::TInstallOptionsPckg iOptionsPckg;
iOptions.iUpgrade = SwiUI::EPolicyAllowed;
iOptions.iOCSP = SwiUI::EPolicyAllowed;
iOptions.iDrive = 'C';
iOptions.iUntrusted = SwiUI::EPolicyAllowed;
iOptions.iCapabilities = SwiUI::EPolicyAllowed;
iOptionsPckg = iOptions;
TBufC<50> FName(KTempPath);//需要安装的SIS文件路径
//Silent insatllation
iLauncher.Connect();
iLauncher.SilentInstall(/*waiter->iStatus,8*/FName,iOptionsPckg);
iLauncher.Close();
GetSinkInfo();
CAknInformationNote* informationNote;
informationNote = new ( ELeave ) CAknInformationNote;
informationNote->ExecuteLD( _L("SilentInstall ok!!"));
下面是卸载
SwiUI::RSWInstLauncher iLauncher;
CleanupClosePushL(iLauncher);
User::LeaveIfError(iLauncher.Connect());
SwiUI::TUninstallOptions iUninstallOptions;
iUninstallOptions.iKillApp = SwiUI::EPolicyAllowed;
iUninstallOptions.iBreakDependency = SwiUI::EPolicyAllowed;
SwiUI::TUninstallOptionsPckg iUninstallOptionsPckg(iUninstallOptions);
iLauncher.SilentUninstall(TUid::Uid(0xA00000EB),iUninstallOptionsPckg,SwiUI::KSisxMimeType);
CleanupStack::PopAndDestroy( &iLauncher );
iEikonEnv->InfoMsg( _L("SilentUninstall ok") );
同样卸载也可以 同步或异步