taha
taha

Reputation: 771

Android delivery information in Telephony.TextBasedSmsColumns

How to check if the message is delivered in the sms content provider (Telephony.TextBasedSmsColumns fields)

Upvotes: 1

Views: 118

Answers (1)

taha
taha

Reputation: 771

By STATUS field

mCursor = contentResolver.query(Uri.parse("content://sms"),
                arrayOf("body", "date", "type", "status"),
                "address like ?",
                arrayOf("%$id"),
                "date asc")

val status = mCursor.getInt(3)
if (status == 0) {
    Toast.makeText(this, "Deliverd", Toast.LENGTH_SHORT)
} else if (status == 32)
    Toast.makeText(this, "Sent and waiting for delivery", Toast.LENGTH_SHORT)
} else if (status == 64) {
    Toast.makeText(this, "Failed", Toast.LENGTH_SHORT)
}

Telephony.TextBasedSmsColumns - STATUS

Upvotes: 1

Related Questions