我尝试过多种方法删除短信记录,包括但不限于线程ID、ID、WHERE子句等。
Android清单反映了读写权限。
我已经尝试了多种SMS内容的变化,例如来自收件箱等。
似乎没有任何方法可以删除记录。
以下是最后一次尝试:
Cursor c = getApplicationContext().getContentResolver().query(Uri.parse("content://sms/"), null, null, null,null);
try {
while (c.moveToNext()) {
int Id = c.getInt(0);
String pid = c.getString(0);
// String uri = "content://sms/conversations/" + threadId;
String strUriAll = "content://sms/" + pid;//SMS_ALL
Log.d("URI is ", strUriAll);
getApplicationContext().getContentResolver().delete(Uri.parse(strUriAll), null, null);
// getApplicationContext().getContentResolver().delete(Uri.parse(strUriAll), null, null);
}
}catch(Exception e){
Log.e(this.toString(),"Error deleting sms",e);
}finally {
c.close();
}