0

I want to start SMS App using Intent to specific phone number with specific message. If I close this window it will return response and returns user to app. But how to cancel and return resultCode to my Activity on SMS Send?

I've tried that one parameter exit_on_sent but it doesnt work.

private fun launchSmsIntent(phoneNum: String){
    val sms = Intent(Intent.ACTION_SENDTO).apply {
        data = Uri.parse("smsto:$phoneNum")
        putExtra("sms_body", PAYMENT_MSG)
        putExtra("exit_on_sent", true)
    }
    a.startActivityForResult(sms, MainActivity.REQUEST_SMS_APP)
}
martin1337
  • 2,384
  • 6
  • 38
  • 85
  • The `"exit_on_sent"` extra is not guaranteed to work everywhere. It's ultimately up to the SMS app to decide what to do after a send. You don't have any control over that. – Mike M. Sep 19 '19 at 08:16

1 Answers1

1

This depends on the application that handles the intent. There is no universal way to achieve this.

There are some sms apps that look for specific parameters in the intent, and can send the result back to the calling app, but these are rare and may have different implementations of this.

As far as I know there is no guaranteed way of doing this.