设置短信为已读的Andr​​oid [英] Set sms as read in Android

查看:262
本文介绍了设置短信为已读的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序需要读取短信,从只有数来临,当我收到我需要将其设置为自动读取,而不在SMS Android应用程序的设置,但是从我的应用程序。我能怎么做? 谢谢!

In my application I need to read sms coming from only a number, and when i receive it I need to set it as read automatically, without setting it in the sms android application, but from my app. How can I do? Thanks!

推荐答案

一个简单的例子:

Uri uri = Uri.parse("content://sms/inbox");
Cursor cursor = context.getContentResolver().query(uri, null, null, null, null);
while (cursor.moveToNext()) {
  // Retrieve sms
  // see column "address" for comparing

  // Then update the sms and set the column "read" to 1
}

这篇关于设置短信为已读的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆