【问题标题】:Any way to send text message without getting a confirmation?有什么方法可以在没有得到确认的情况下发送短信?
【发布时间】:2016-12-21 17:03:13
【问题描述】:

有没有什么方法可以在没有得到确认的情况下发送短信?我目前的代码是:

String phoneNumber = "1234567";
        Intent intent = new Intent(Intent.ACTION_SENDTO);
        intent.setData(Uri.parse("smsto:" + phoneNumber));  // This ensures only SMS apps respond
        intent.putExtra("sms_body", "TESTING TEXT MESSAGE! IT WORKS!");
        if (intent.resolveActivity(getPackageManager()) != null) {
            startActivity(intent);
        }

【问题讨论】:

标签: android


【解决方案1】:

是的,您应该使用SmsManager。这是一个例子:

SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage("phoneNo", null, "sms message", null, null);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-30
    • 1970-01-01
    • 2018-12-25
    相关资源
    最近更新 更多