【发布时间】:2020-01-20 05:08:56
【问题描述】:
我想使用 Intent 启动 SMS 应用程序到带有特定消息的特定电话号码。如果我关闭此窗口,它将返回响应并将用户返回到应用程序。但是如何取消并返回resultCode 到我的短信发送活动?
我试过那个参数exit_on_sent,但它不起作用。
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)
}
【问题讨论】:
-
"exit_on_sent"extra 不能保证在任何地方都能正常工作。最终由 SMS 应用程序决定发送后要做什么。你对此没有任何控制权。
标签: android kotlin android-sms