简体   繁体   English

在 Android 上将短信标记为已读不起作用

[英]Marking SMS as read on Android not working

I'm trying to mark a message as read on a Samsung Galaxy S6 and it is not working.我试图在三星 Galaxy S6 上将消息标记为已读,但它不起作用。 I have following tutorials online.我有以下在线教程。 My code is below:我的代码如下:

Uri uri = Uri.parse("content://sms/inbox");
Cursor cursor = context.getContentResolver().query(uri, null, "_id=" + id, null, null);
try {
    if (cursor.getCount() != 0) {
        ContentValues values = new ContentValues();
        values.put("read", true);
        context.getContentResolver().update(uri, values, "_id=?", new String[] { id });
    }
} catch (Exception e) {
    Log.e("Mark Read", "Error in Read: " + e.toString());
} finally {
    cursor.close();
}

Is there something i'm doing wrong?有什么我做错了吗? I pass in a id to this method and the message is always marked as unread.我将id传递给此方法,并且消息始终标记为未读。 How is it that other SMS applications can mark as read and I cannot?为什么其他 SMS 应用程序可以标记为已读而我不能?

Turns out you cannot mark SMS messages as read if you are NOT the default SMS client.事实证明,如果您不是默认的 SMS 客户端,则无法将 SMS 消息标记为已读。 Lame!瘸!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM