0

I'm reading devices SMS messages and displaying on Listview. Whenever i tap on item from the list then i would like to open that person conversation list and i want to scroll cursor to that particular message position by hi-lighted that selected message. for example: If we conversation with between Alice and Bob about 100 distinct messages. If i select their 5th messages. My cursor will go that 5th message and hi-lighted.

I've played around following code snippets

Option 1:

 val intent = Intent(Intent.ACTION_QUICK_VIEW)
            val uri = Uri.withAppendedPath(
                Telephony.MmsSms.CONTENT_CONVERSATIONS_URI,
                contactsInfo.threadId // contactsInfo.phoneNumber as well  
            )
           intent.data = uri
            intent.setPackage(Telephony.Sms.getDefaultSmsPackage(context))
            context.startActivity(intent)

Option 2:

 val intent = Intent(
                Intent.ACTION_VIEW,
                Uri.fromParts(
                    "sms",
                    contactsInfo.address,  // address means phoneNo
                    null
                )
            )
            intent.setPackage(Telephony.Sms.getDefaultSmsPackage(context))
            intent.putExtra("intent_extra_data_key", contactsInfo.smsBody)
            context.startActivity(intent)

0 Answers0