Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void uninstallApp(String packageName){
- try {
- String[] command = new String[4];
- command[0] = "su";
- command[1] = "mount -o remount,rw /system";
- command[2] = "rm " + packageName;
- command[3] = "reboot";
- Runtime run = Runtime.getRuntime();
- run.exec(command);
- Log.d("DELETED", packageName);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- Log.e("ERROR ON DELETE", e.getMessage());
- }
- }
- StringBuilder cmdReturn = new StringBuilder();
- try {
- ProcessBuilder processBuilder = new ProcessBuilder("su","-c mount -o remount,rw /system ; rm " + packageName + " ; reboot");
- Process process = processBuilder.start();
- InputStream inputStream = process.getInputStream();
- int c;
- while ((c = inputStream.read()) != -1) {
- cmdReturn.append((char) c);
- }
- Log.d("CMD RESPONSE", cmdReturn.toString());
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement