How to get contact name for sms conversations?

前端 未结 2 374
时光说笑
时光说笑 2021-01-14 03:18

I\'m retrieving list of last sms/mms conversations using following query:

String[] columns={\"type\", \"address\", \"date\", \"body\", \"conversation_id\"};
         


        
2条回答
  •  无人及你
    2021-01-14 04:17

    I made this using this workaround:

    val uri = Uri.parse("content://sms")
    val projection = arrayOf("DISTINCT $THREAD_ID", _ID, ADDRESS, BODY, DATE, TYPE)
    val selection = "$THREAD_ID IS NOT NULL) GROUP BY ($THREAD_ID"
    
    contentResolver.query(uri, projection , selection, null, "date DESC")
    

    If someone knows better approach, please, share it.

提交回复
热议问题