Get the receiver's number from an SMS on Android
I am using the below code to get originatingAddress (the sender's number).
import android.provider.Telephony.Sms.Intents.getMessagesFromIntent
fun getFullMessage(messageParts: Array): CompleteSmsMessage {
messageParts = getFullMessage(getMessagesFromIntent(intent))
messageParts.last().also { part ->
return CompleteSmsMessage(
originatingAddress = part.originatingAddress,
body = messageParts
.map { it.messageBody }
.reduce { acc, body -> acc + body }...