简体   繁体   中英

How to send SMS message to another android device from my app

I declared these two variables in order to send a text message to declared number:

private String text="Hi";
private String emergencyNum="00962789113300"; 

Then in onCreat() method I wrote this:

SmsManager sender= SmsManager.getDefault();
sender.sendTextMessage(emergencyNum, null, text, null, null); 

Unfortunately, the message was not sent and I got not responding status for my app. Could you help me to solve the problem.

请将以下权限放入AndroidManifest.xml文件。

<uses-permission android:name="android.permission.SEND_SMS"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM