1

How do i retreive RCS messages in android. I can retreive SMS/MMS using contentproviders, is there any URI for RCS messaging availlable for android?

I found that my device has this contentprovider availlabe so I tried using this :

  Uri.parse("content://com.gsma.services.rcs.provider.chat/chatmessage")

but this gives me a Security Exception like This :

java.lang.SecurityException: Permission Denial: opening provider com.sec.internal.ims.servicemodules.tapi.service.provider.ChatProvider from ProcessRecord{31c3db7 9607:com.sol.testsms/u0a403} (pid=9607, uid=10403) requires com.gsma.services.permission.RCS or com.sec.imsservice.WRITE_IMS_PERMISSION

after adding the permissions stated in the error message I still get the error.

Can anyone help with this?

Ryan M
  • 18,333
  • 31
  • 67
  • 74
Toufiq Akbar
  • 35
  • 1
  • 9

1 Answers1

1

This is worked only in the device where google messaging is enabled :

RCS message basically is stored in Uri.parse("content://mms") content providers.You can alternatively useTelephony.Mms.CONTENT_URI. You can read the RCS related message by passing the URI Uri.parse("content://mms") in the contentResolver. Actually mms content type read the both mms and RCS message. Sample code is given here.

 val cursor = contentResolver.query(
        Uri.parse("content://mms"),
        arrayOf("*"),
        "thread_id = ?",
        selectionArgs,
        null
    )
Tausif
  • 778
  • 1
  • 5
  • 14
  • 1
    i tried your approach and was finally able to get some RCS messages in my app. you are a lifesaver. – Toufiq Akbar Mar 06 '23 at 12:27
  • 1
    Is this how all messaging apps handle it? or is this exclusive to Google's? Does Samsung Messages also simply store the RCS as if it was an MMS message? – undermark5 Mar 07 '23 at 20:21
  • Tested in Samsung , google pixel and xiomi device so far and found that the RCS message is in MMS . Need to confirm about the other devices – Tausif Mar 08 '23 at 09:07
  • 1
    I wasn't asking about devices, but rather apps themselves. you can use Google's Messages app on any device, but not every device/app that can send and receive RCS is necessarily going to do so in the same way (that is, assuming the system isn't actually the one storing them this way) – undermark5 Mar 21 '23 at 15:50
  • Yes, Samsung messages are not stored in the same way. I updated the answer. – Tausif Mar 23 '23 at 08:15