`

静默卸载系统软件和第三方软件

阅读更多

      一个个卸载软件,弹出卸载软件提示好麻烦,现在特作出下列方法,可以静默卸载

静默安装敬请期待。。。。

 

          //下面3句是静默卸载系统软件命令
            String busybox="mount -o remount rw /system";
         String chmod="chmod 777 /system/app/HtcTwitter.apk";
         uninstallapk="rm -r /system/app/HtcTwitter.apk";
        
         //下面3句是静默卸载第三方软件命令
         String busybox1="mount -o remount rw /data";
         String chmod1="chmod 777 /data/app/com.yingyonghui.market-2.apk";
         uninstallapk1="pm uninstall com.yingyonghui.market";
        
         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();
       }
    }

0
0
分享到:
评论
3 楼 sxchao2008 2012-09-20  
心雨心 写道
你说的不好用是?

你好,在静默卸载系统级别app的时候,
  String busybox="mount -o remount rw /system";
        String chmod="chmod 777 /system/app/VideoEditorGoogle.apk";
        uninstallapk="rm -r /system/app/VideoEditorGoogle.apk";

代码不起作用,测试机 android galaxy nexus ,4.1.1 已root.
但是通过adb shell 输入3个命令却可以卸载系统应用.这该如何解释?!
2 楼 心雨心 2012-03-12  
你说的不好用是?
1 楼 fanfansss 2012-02-01  
在android2.3.3中,你的代码不起作用。

相关推荐

Global site tag (gtag.js) - Google Analytics