从SMStable android系统中删除短信 [英] delete SMS from SMStable in android
本文介绍了从SMStable android系统中删除短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前我正在试图从Android删除短信表中的短信。
我用这个来删除短信,但有错误。
这是正确的语法?
邮件ID是消息的ID被删除。
乌里uriSMSURI = Uri.parse(内容://短信/收件箱/+ MESSAGEID); 。getContentResolver()删除(uriSMSURI,NULL,NULL);
解决方案
有关delete一个短信,你必须在AndroidManifest.xml中添加这些权限:
<使用许可权的android:NAME =android.permission.WRITE_SMS> < /使用许可权>
<使用许可权的android:NAME =android.permission.READ_SMS> < /使用许可权>
URI的读取和删除短信:
//可用URI字符串
字符串strUriInbox =内容://短信/收件箱; // SMS_INBOX:1
字符串strUriFailed =内容://短信/失败; // SMS_FAILED:2
字符串strUriQueued =内容://短信/排队; // SMS_QUEUED:3
字符串strUriSent =内容://短信/发送; // SMS_SENT:4
字符串strUriDraft =内容://短信/草案; // SMS_DRAFT:5
字符串strUriOutbox =内容://短信/发件箱; // SMS_OUTBOX:6
字符串strUriUndelivered =内容://短信/未交付; // SMS_UNDELIVERED
字符串strUriAll =内容://短信/所有; // SMS_ALL
字符串strUriConversations =内容://短信/通话; //你可以删除的thread_id一个对话
字符串strUriAll =内容://短信//您可以通过删除_id一个消息
I am currently trying to delete a SMS from the SMS table from android. I used this to delete the SMS but there are errors. Is this the correct syntax? the messageID is the id of the message to be deleted.
Uri uriSMSURI = Uri.parse("content://sms/inbox/" + messageID);
getContentResolver().delete(uriSMSURI, null, null);
解决方案
for deleteing an sms you must add these permissions in AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_SMS"> </ uses-permission>
<uses-permission android:name="android.permission.READ_SMS"> </ uses-permission>
URI's for reading and deleting sms:
//Available Uri string
String strUriInbox = "content://sms/inbox";//SMS_INBOX:1
String strUriFailed = "content://sms/failed";//SMS_FAILED:2
String strUriQueued = "content://sms/queued";//SMS_QUEUED:3
String strUriSent = "content://sms/sent";//SMS_SENT:4
String strUriDraft = "content://sms/draft";//SMS_DRAFT:5
String strUriOutbox = "content://sms/outbox";//SMS_OUTBOX:6
String strUriUndelivered = "content://sms/undelivered";//SMS_UNDELIVERED
String strUriAll = "content://sms/all";//SMS_ALL
String strUriConversations = "content://sms/conversations";//you can delete one conversation by thread_id
String strUriAll = "content://sms"//you can delete one message by _id
这篇关于从SMStable android系统中删除短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文