symbian 静默安装卸载程序

一、需要的头文件:

#include <SWInstApi.h>
#include <SWInstDefs.h>

二、需要的LIB库:

swinstcli.lib

三。需要的能力:

TrustedUI

四、安装应用程序 :

 _LIT( KTempPath , "c://SilTest.SISx" );

 CAOSync* waiter = CAOSync::NewL();   
            
      CleanupStack::PushL( waiter );
              
      iOptions.iUpgrade = SwiUI::EPolicyNotAllowed;
      iOptions.iOCSP = SwiUI::EPolicyNotAllowed;
      iOptions.iDrive = 'C';   
      iOptions.iUntrusted = SwiUI::EPolicyNotAllowed; 
      iOptions.iCapabilities = SwiUI::EPolicyNotAllowed; 
        
      iOptionsPckg = iOptions;   
         
     
      TBufC<200> FName(KTempPath);
      
      //Silent insatllation
               
      iLauncher.SilentInstall(waiter->iStatus,FName,iOptionsPckg);
      
       waiter->Execute();

     CleanupStack::PopAndDestroy( waiter );

五。卸载应用程序 :

  const TUid  KMyAppUid  = {0x12345678} ;
             
 //Silent insatllation
            
 SwiUI::TUninstallOptions options; 
 SwiUI::TUninstallOptionsPckg optionsPckg; 
 options.iKillApp = SwiUI::EPolicyAllowed; 
options.iBreakDependency = SwiUI::EPolicyAllowed; 
optionsPckg = options;                  
iLauncher.SilentUninstall(KMyAppUid, optionsPckg, SwiUI::KSisxMimeType);

六,参考资料:

/S60_3rd_SDK_MR_API_Plug-In_Pack_v5_43

下载地址:

http://www.forum.nokia.com/info/sw.nokia.com/id/53439e01-f605-4491-96f4-62d003bd4c0c/S60_3rd_SDK_MR_API_Plug-In_Pack1.zip.html

SilentInst.zip

http://wiki.forum.nokia.com/images/2/2f/SilentInst.zip

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/brew2003/archive/2008/12/23/3587982.aspx

 

 

 

简单的同步方式卸载,一个函数就实现了
//*************************************************
// author: jeme
//*************************************************
TBool DeleteApplication(const TUint32 aUid)
{
    TBool re = ETrue;     
    TUid uid;
    uid.iUid = aUid;
    
    SwiUI::RSWInstSilentLauncher launcher;
    TInt err = launcher.Connect();
    if(err != KErrNone)
    {
        re =EFalse;
        return re;
    }
    CleanupClosePushL( launcher );
    SwiUI::TUninstallOptions options;
    options.iBreakDependency = SwiUI::EPolicyAllowed; 
    options.iKillApp = SwiUI::EPolicyAllowed; 
    SwiUI::TUninstallOptionsPckg optPckg( options );    
    TRequestStatus   status = KRequestPending;      
    launcher.SilentUninstall( status, uid,optPckg,SwiUI::KSisxMimeType());    
    if(status != KRequestPending)
    {
        re = EFalse;
    }
    while( status == KRequestPending )
    {       
        User::After(5000);  // 或者可以做其他事情
    }    
    if(status != KErrNone)
    {
        re = EFalse;
    }
    launcher.CancelAsyncRequest( SwiUI::ERequestSilentUninstall );      
    CleanupStack::PopAndDestroy( &launcher );      
    return re;  
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值