赞
踩
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class AdbSmsDelete {
public static void main(String[] args) {
String smsId = "1234"; // 要删除的短信ID
String command = "adb shell content://sms/" + smsId + " -d"; // ADB删除命令
try {
Process process = Runtime.getRuntime().exec(command);
InputStream inputStream = process.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String line;
while ((line = bufferedReader.readLine()) != null) {
System.out.println(line);
}
// 检查退出码,0表示成功,其他表示有错误
int exitCode = process.waitFor();
if (exitCode == 0) {
System.out.println("短信已被成功删除");
} else {
System.out.println("无法删除短信");
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。