Set sms as read in Android

后端 未结 2 1909
情话喂你
情话喂你 2020-12-11 19:28

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 applicati

2条回答
  •  旧时难觅i
    2020-12-11 19:57

    A short example:

    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
    }
    

提交回复
热议问题