Added in API level 1
Deprecated in API level 4

SmsManager

public final class SmsManager
extends Object

java.lang.Object
   ↳ android.telephony.gsm.SmsManager


This class was deprecated in API level 4.
Replaced by android.telephony.SmsManager that supports both GSM and CDMA.

Manages SMS operations such as sending data, text, and pdu SMS messages. Get this object by calling the static method SmsManager.getDefault().

Summary

Constants

int RESULT_ERROR_GENERIC_FAILURE

This constant is deprecated. Use android.telephony.SmsManager.

int RESULT_ERROR_NO_SERVICE

This constant is deprecated. Use android.telephony.SmsManager.

int RESULT_ERROR_NULL_PDU

This constant is deprecated. Use android.telephony.SmsManager.

int RESULT_ERROR_RADIO_OFF

This constant is deprecated. Use android.telephony.SmsManager.

int STATUS_ON_SIM_FREE

This constant is deprecated. Use android.telephony.SmsManager.

int STATUS_ON_SIM_READ

This constant is deprecated. Use android.telephony.SmsManager.

int STATUS_ON_SIM_SENT

This constant is deprecated. Use android.telephony.SmsManager.

int STATUS_ON_SIM_UNREAD

This constant is deprecated. Use android.telephony.SmsManager.

int STATUS_ON_SIM_UNSENT

This constant is deprecated. Use android.telephony.SmsManager.

Public methods

ArrayList<String> divideMessage(String text)

This method is deprecated. Use android.telephony.SmsManager.

static SmsManager getDefault()

This method is deprecated. Use android.telephony.SmsManager.

void sendDataMessage(String destinationAddress, String scAddress, short destinationPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent)

This method is deprecated. Use android.telephony.SmsManager.

void sendMultipartTextMessage(String destinationAddress, String scAddress, ArrayList<String> parts, ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents)

This method is deprecated. Use android.telephony.SmsManager.

void sendTextMessage(String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent)

This method is deprecated. Use android.telephony.SmsManager.

Inherited methods

Constants

RESULT_ERROR_GENERIC_FAILURE

Added in API level 1
public static final int RESULT_ERROR_GENERIC_FAILURE

This constant is deprecated.
Use android.telephony.SmsManager.

Generic failure cause

Constant Value: 1 (0x00000001)

RESULT_ERROR_NO_SERVICE

Added in API level 1
public static final int RESULT_ERROR_NO_SERVICE

This constant is deprecated.
Use android.telephony.SmsManager.

Failed because service is currently unavailable

Constant Value: 4 (0x00000004)

RESULT_ERROR_NULL_PDU

Added in API level 1
public static final int RESULT_ERROR_NULL_PDU

This constant is deprecated.
Use android.telephony.SmsManager.

Failed because no pdu provided

Constant Value: 3 (0x00000003)

RESULT_ERROR_RADIO_OFF

Added in API level 1
public static final int RESULT_ERROR_RADIO_OFF

This constant is deprecated.
Use android.telephony.SmsManager.

Failed because radio was explicitly turned off

Constant Value: 2 (0x00000002)

STATUS_ON_SIM_FREE

Added in API level 1
public static final int STATUS_ON_SIM_FREE

This constant is deprecated.
Use android.telephony.SmsManager.

Free space (TS 51.011 10.5.3).

Constant Value: 0 (0x00000000)

STATUS_ON_SIM_READ

Added in API level 1
public static final int STATUS_ON_SIM_READ

This constant is deprecated.
Use android.telephony.SmsManager.

Received and read (TS 51.011 10.5.3).

Constant Value: 1 (0x00000001)

STATUS_ON_SIM_SENT

Added in API level 1
public static final int STATUS_ON_SIM_SENT

This constant is deprecated.
Use android.telephony.SmsManager.

Stored and sent (TS 51.011 10.5.3).

Constant Value: 5 (0x00000005)

STATUS_ON_SIM_UNREAD

Added in API level 1
public static final int STATUS_ON_SIM_UNREAD

This constant is deprecated.
Use android.telephony.SmsManager.

Received and unread (TS 51.011 10.5.3).

Constant Value: 3 (0x00000003)

STATUS_ON_SIM_UNSENT

Added in API level 1
public static final int STATUS_ON_SIM_UNSENT

This constant is deprecated.
Use android.telephony.SmsManager.

Stored and unsent (TS 51.011 10.5.3).

Constant Value: 7 (0x00000007)

Public methods

divideMessage

Added in API level 1
public ArrayList<String> divideMessage (String text)

This method is deprecated.
Use android.telephony.SmsManager.

Divide a text message into several messages, none bigger than the maximum SMS message size.

Parameters
text String: the original message. Must not be null.

Returns
ArrayList<String> an ArrayList of strings that, in order, comprise the original message

getDefault

Added in API level 1
public static SmsManager getDefault ()

This method is deprecated.
Use android.telephony.SmsManager.

Get the default instance of the SmsManager

Returns
SmsManager the default instance of the SmsManager

sendDataMessage

Added in API level 1
public void sendDataMessage (String destinationAddress, 
                String scAddress, 
                short destinationPort, 
                byte[] data, 
                PendingIntent sentIntent, 
                PendingIntent deliveryIntent)

This method is deprecated.
Use android.telephony.SmsManager.

Send a data based SMS to a specific application port.

Parameters
destinationAddress String: the address to send the message to

scAddress String: is the service center address or null to use the current default SMSC

destinationPort short: the port to deliver the message to

data byte: the body of the message to send

sentIntent PendingIntent: if not NULL this PendingIntent is broadcast when the message is sucessfully sent, or failed. The result code will be Activity.RESULT_OK for success, or one of these errors: RESULT_ERROR_GENERIC_FAILURE RESULT_ERROR_RADIO_OFF RESULT_ERROR_NULL_PDU. The per-application based SMS control checks sentIntent. If sentIntent is NULL the caller will be checked against all unknown applicaitons, which cause smaller number of SMS to be sent in checking period.

deliveryIntent PendingIntent: if not NULL this PendingIntent is broadcast when the message is delivered to the recipient. The raw pdu of the status report is in the extended data ("pdu").

Throws
IllegalArgumentException if destinationAddress or data are empty

sendMultipartTextMessage

Added in API level 1
public void sendMultipartTextMessage (String destinationAddress, 
                String scAddress, 
                ArrayList<String> parts, 
                ArrayList<PendingIntent> sentIntents, 
                ArrayList<PendingIntent> deliveryIntents)

This method is deprecated.
Use android.telephony.SmsManager.

Send a multi-part text based SMS. The callee should have already divided the message into correctly sized parts by calling divideMessage.

Parameters
destinationAddress String: the address to send the message to

scAddress String: is the service center address or null to use the current default SMSC

parts ArrayList: an ArrayList of strings that, in order, comprise the original message

sentIntents ArrayList: if not null, an ArrayList of PendingIntents (one for each message part) that is broadcast when the corresponding message part has been sent. The result code will be Activity.RESULT_OK for success, or one of these errors: RESULT_ERROR_GENERIC_FAILURE RESULT_ERROR_RADIO_OFF RESULT_ERROR_NULL_PDU. The per-application based SMS control checks sentIntent. If sentIntent is NULL the caller will be checked against all unknown applicaitons, which cause smaller number of SMS to be sent in checking period.

deliveryIntents ArrayList: if not null, an ArrayList of PendingIntents (one for each message part) that is broadcast when the corresponding message part has been delivered to the recipient. The raw pdu of the status report is in the extended data ("pdu").

Throws
IllegalArgumentException if destinationAddress or data are empty

sendTextMessage

Added in API level 1
public void sendTextMessage (String destinationAddress, 
                String scAddress, 
                String text, 
                PendingIntent sentIntent, 
                PendingIntent deliveryIntent)

This method is deprecated.
Use android.telephony.SmsManager.

Send a text based SMS.

Parameters
destinationAddress String: the address to send the message to

scAddress String: is the service center address or null to use the current default SMSC

text String: the body of the message to send

sentIntent PendingIntent: if not NULL this PendingIntent is broadcast when the message is successfully sent, or failed. The result code will be Activity.RESULT_OK for success, or one of these errors: RESULT_ERROR_GENERIC_FAILURE RESULT_ERROR_RADIO_OFF RESULT_ERROR_NULL_PDU. The per-application based SMS control checks sentIntent. If sentIntent is NULL the caller will be checked against all unknown applications, which cause smaller number of SMS to be sent in checking period.

deliveryIntent PendingIntent: if not NULL this PendingIntent is broadcast when the message is delivered to the recipient. The raw pdu of the status report is in the extended data ("pdu").

Throws
IllegalArgumentException if destinationAddress or text are empty