1. 静默卸载怎么搞?
2. 手机必须root过吗?
3. 我的代码必须有root权限吗?

解决方案 »

  1.   

     //下面3句是静默卸载第三方软件命令
             String busybox1="mount -o remount rw /data";
             String chmod1="chmod 777 /data/app/com.yingyonghui.et-2.apk";
             uninstallapk1="pm uninstall com.yingyonghui.et";
             
             chmodApk(busybox1,chmod1);
     
     
     
      /*
         * 对要卸载的apk赋予权限
         */
        public void chmodApk(String busybox ,String chmod)
        {
         try {
         
           Process process = null;
       DataOutputStream os = null;
       process = Runtime.getRuntime().exec("su");
       os = new DataOutputStream(process.getOutputStream());
       os.writeBytes(busybox);
            os.flush();
            
            os.writeBytes(chmod);
            os.flush();
            
            os.close();
           } catch (Exception ex) {
               ex.printStackTrace();
           }
        }
        
        
        /*
         * 卸载apk
         */
        public void uninstallApk(String uninstallapk)
        {
         try {
             
           Process process = null;
       DataOutputStream os = null;
       process = Runtime.getRuntime().exec("su");
       os = new DataOutputStream(process.getOutputStream());
            os.writeBytes(uninstallapk);
            os.flush();
            
            os.close();
           } catch (Exception ex) {
               ex.printStackTrace();
           }