Sushan Ghimire
Sushan Ghimire

Reputation: 7567

Android programming sms messaging

I'm a newbie on Android development platform.

Can a third party application (say the one I'm developing) send SMS messages?

I believe we do not have access to default text messaging app. Therefore I plan to develop one on my own, which will read words used and process such texts before delivering to receiver. I would like to know if there are such APIs which allow to send text messages.

Upvotes: 0

Views: 2592

Answers (3)

Aman
Aman

Reputation: 8995

Here is a simple snippet that might help:

SmsManager smsMgr=SmsManager.getDefault();
String destination="9999119911";
String msg="Hello World";
smsMgr.sendTextMessage(destination,null,msg,null,null);

Don't Forget to add

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

to AndroidManifest.xml

Testing : You can send SMS from one instance of emulator to another ,to do that ,simply specify the port number of the other instance as destination . to check the port number :

$ /opt/android-sdk/platform-tools/adb devices

Upvotes: 1

ToastyMallows
ToastyMallows

Reputation: 4273

http://thinkandroid.wordpress.com/2010/01/08/sending-sms-from-application/

I think this is what you are looking for. The second method described in the article does not need any additional permissions, but it requires that the user types the message. I don't think there is a way to send an SMS without the permission.

Upvotes: 0

user485498
user485498

Reputation:

A good place to start is here http://developer.android.com/reference/android/telephony/SmsManager.html

You need to use the SmsManager class, if you want to include SMS capability in your app.

Upvotes: 0

Related Questions