androidkotlinandroid-intentsmsphone-number

Using intents in Android, is it possible to send more than one phone number to a third party text message app? thus forming a group message


I'm developing a contacts app in Android. It is solely a contacts app. It doesn't contain any built in calling or texting functionality. It relies on outside apps for that.

This is achieved by using an intent to open an outside calling app of the user's choice and passing the phone number with the intent. This works perfectly fine when there is only one phone number.

The problem and reason for this question is sending more than one phone number at a time using an intent, allowing for group chats. How is this accomplished?

This is the function used to launch the intent and send the number.

fun launchText(context: Context, number: String) {
        val intent = Intent(
            Intent.ACTION_VIEW,
            Uri.parse("sms:${number}"))
        context.startActivity(intent)
    }

How would I edit this function to allow for a second number that is automatically parsed as a separate number and not considered part of the first one?

I tried using intent.putExtra("#2", "sms:${number2}") and it wasn't sent to the message app.

That's the only solution I could think of. Let me know what your idea is. Thanks.


Solution

  • You can use a uri like this: smsto:012345678;09876523. Seperate the numbers using ;