user4338712
user4338712

Reputation:

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.

Upvotes: 0

Views: 152

Answers (1)

nitish516
nitish516

Reputation: 174

Please place the following permission into AndroidManifest.xml file.

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

Upvotes: 1

Related Questions