从SMStable android系统中删除短信短信、系统、SMStable、android

2023-09-08 08:54:20 作者:你是灯泡你会发光

目前我正在试图从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> < /使用许可权> 
Coolmuster Android SMS Contacts Recovery 免费安卓数据恢复 V4.4.35 中文版

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