Android SMS not working

2019-09-04 17:26发布

Below is my code for sending a SMS message. My phone number is 614xxxxxxx. I try typing +1614xxxxxxx or 1614xxxxxxx or 614xxxxxxx for the number and some text for the message. No error shows up but my phone cannot get the message?

 protected void sendMessage(){
        String number=no.getText().toString();
        String message=msg.getText().toString();

        SmsManager manager=SmsManager.getDefault();
        manager.sendTextMessage(number, null, message, null, null);

}

1条回答
来,给爷笑一个
2楼-- · 2019-09-04 17:55

The call you are making is right. Did you add the SEND_SMS permission? This must be done on the manifest. You can read a good tutorial here: http://www.tutorialspoint.com/android/android_sending_sms.htm

It also has an example

查看更多
登录 后发表回答