Sending SMS Messages Manually

SMS messaging in Android is handled by the SmsManager. You can get a reference to the SMS Manager using the static method SmsManager.getDefault, as shown in the following snippet.

SmsManager smsManager = SmsManager.getDefault();

Prior to Android 1.6 (SDK level 4) the SmsManager and SmsMessage classes were provided by the android.telephony.gsm package. These have now been deprecated and the SMS classes moved to android.telephony to ensure generic support for GSM and CDMA devices.

To send SMS messages, your applications must specify the send_sms uses-permission. To request this permission, add it to the manifest as shown below:

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

Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide


Post a comment