大部分手机分享短信这样写,都没有问题
val smsToUri = Uri.parse("smsto:")
val sendIntent = Intent(Intent.ACTION_VIEW, smsToUri)
sendIntent.putExtra("sms_body", url)
if (null != activity) {
try {
activity.startActivityForResult(sendIntent, 1002)
} catch (e: Exception) {
e.printStackTrace()
ToastUtils.showLongToast(activity, "On SMS")
}
}
华为p20不好使,要这样写
val smsToUri = Uri.parse("smsto:")
val sendIntent = Intent(Intent.ACTION_SENDTO, smsToUri)
sendIntent.putExtra("sms_body", url)
if (null != activity) {
try {
activity.startActivityForResult(sendIntent, 1002)
} catch (e: Exception) {
e.printStackTrace()
ToastUtils.showLongToast(activity, "On SMS")
}
}
网友评论