【发布时间】:2015-10-21 14:29:49
【问题描述】:
我尝试过从 SMS 中删除全部或部分消息的变体,包括但不限于线程 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();
}
【问题讨论】:
-
你在哪个版本的 Android 上测试这个?
-
-
不,您使用的设备/模拟器是什么版本的 Android
-
4.4.2 api 19,也在物理设备 Galaxy S5 上运行