Android的短信不工作 [英] Android SMS not working

查看:176
本文介绍了Android的短信不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的code用于发送短信。我的电话号码为614xxxxxxx。我尝试打字+ 1614xxxxxxx或1614xxxxxxx或614xxxxxxx的数量和一些文本的消息。没有错误显示出来,但我的手机不能得到的消息?

 保护无效的sendMessage(){
        。弦数= no.getText()的toString();
        字符串消息= msg.getText()的toString()。        SmsManager经理= SmsManager.getDefault();
        manager.sendTextMessage(数字,空,消息,NULL,NULL);}


解决方案

在正在进行的呼叫是正确的。
你加SEND_SMS许可?这必须对清单进行。
你可以在这里读到一个很好的教程:
http://www.tutorialspoint.com/android/android_sending_sms.htm

它也有一个例子

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);

}

解决方案

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

这篇关于Android的短信不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆