需要一个有权限的 APK 在手机实时存储短信到手机内存 /sdcard/smslog.txt 里(外部SD卡也可以知道能通过adb命令访问到):
/*****
......
try {
long timestamp = System.currentTimeMillis();
String time = formatter.format(new Date());
String fileName = "smsLog.txt";
if (Environment.getExternalStorageState().equals(Environment.MOUNTED)) {
String path = Environment.getExternalStorageDirectory()+"/";
***
if (!dir.exists()) {
dir.mkdirs();
}
*
fos.write((time + " " + s).getBytes());
fos.close();
}
return fileName;
} catch (Exception e) {
Log.e("sms", "an error occured while writing file...", e);
}
return null;
}
*******/
android脚本好了,签名+打包,装入手机就好了,安装实验一下: