How to select messages from a specific phone number (Kotlin Android)

21 Views Asked by At
val cursor = contentResolver.query(Uri.parse("content://sms/inbox"), null, null, null, null)
    if (cursor != null) {
        //cursor.moveToFirst()
        cursor.moveToPosition(1)

        var text = cursor.getString(12)
        Toast.makeText(applicationContext,text,Toast.LENGTH_SHORT).show()
    }

1- I want to read received messages from "50004000151398" only (not all inbox)

2- I want to see how many messages I have received from "50004000151398"

What should I do?

(I did not understand the current answers)

0

There are 0 best solutions below