|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.telephony.gsm.SmsManager
public final class SmsManager
Manages SMS operations such as sending data, text, and pdu SMS messages. Get this object by calling the static method SmsManager.getDefault().
| Field Summary | |
|---|---|
static int |
RESULT_ERROR_GENERIC_FAILURE
Generic failure cause |
static int |
RESULT_ERROR_NO_SERVICE
Failed because service is currently unavailable |
static int |
RESULT_ERROR_NULL_PDU
Failed because no pdu provided |
static int |
RESULT_ERROR_RADIO_OFF
Failed because radio was explicitly turned off |
static int |
STATUS_ON_SIM_FREE
Free space (TS 51.011 10.5.3). |
static int |
STATUS_ON_SIM_READ
Received and read (TS 51.011 10.5.3). |
static int |
STATUS_ON_SIM_SENT
Stored and sent (TS 51.011 10.5.3). |
static int |
STATUS_ON_SIM_UNREAD
Received and unread (TS 51.011 10.5.3). |
static int |
STATUS_ON_SIM_UNSENT
Stored and unsent (TS 51.011 10.5.3). |
| Method Summary | |
|---|---|
boolean |
copyMessageToSim(byte[] smsc,
byte[] pdu,
int status)
Copy a raw SMS PDU to the SIM. |
boolean |
deleteMessageFromSim(int messageIndex)
Delete the specified message from the SIM. |
ArrayList<String> |
divideMessage(String text)
Divide a text message into several messages, none bigger than the maximum SMS message size. |
ArrayList<SmsMessage> |
getAllMessagesFromSim()
Retrieves all messages currently stored on SIM. |
static SmsManager |
getDefault()
Get the default instance of the SmsManager |
void |
sendDataMessage(String destinationAddress,
String scAddress,
short destinationPort,
byte[] data,
PendingIntent sentIntent,
PendingIntent deliveryIntent)
Send a data based SMS to a specific application port. |
void |
sendMultipartTextMessage(String destinationAddress,
String scAddress,
ArrayList<String> parts,
ArrayList<PendingIntent> sentIntents,
ArrayList<PendingIntent> deliveryIntents)
Send a multi-part text based SMS. |
void |
sendTextMessage(String destinationAddress,
String scAddress,
String text,
PendingIntent sentIntent,
PendingIntent deliveryIntent)
Send a text based SMS. |
boolean |
updateMessageOnSim(int messageIndex,
int newStatus,
byte[] pdu)
Update the specified message on the SIM. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int STATUS_ON_SIM_FREE
public static final int STATUS_ON_SIM_READ
public static final int STATUS_ON_SIM_UNREAD
public static final int STATUS_ON_SIM_SENT
public static final int STATUS_ON_SIM_UNSENT
public static final int RESULT_ERROR_GENERIC_FAILURE
public static final int RESULT_ERROR_RADIO_OFF
public static final int RESULT_ERROR_NULL_PDU
public static final int RESULT_ERROR_NO_SERVICE
| Method Detail |
|---|
public void sendTextMessage(String destinationAddress,
String scAddress,
String text,
PendingIntent sentIntent,
PendingIntent deliveryIntent)
destinationAddress - the address to send the message toscAddress - is the service center address or null to use
the current default SMSCtext - the body of the message to sendsentIntent - 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 - 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 emptypublic ArrayList<String> divideMessage(String text)
text - the original message. Must not be null.
ArrayList of strings that, in order,
comprise the original message
public void sendMultipartTextMessage(String destinationAddress,
String scAddress,
ArrayList<String> parts,
ArrayList<PendingIntent> sentIntents,
ArrayList<PendingIntent> deliveryIntents)
divideMessage.
destinationAddress - the address to send the message toscAddress - is the service center address or null to use
the current default SMSCparts - an ArrayList of strings that, in order,
comprise the original messagesentIntents - 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 - 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").
public void sendDataMessage(String destinationAddress,
String scAddress,
short destinationPort,
byte[] data,
PendingIntent sentIntent,
PendingIntent deliveryIntent)
destinationAddress - the address to send the message toscAddress - is the service center address or null to use
the current default SMSCdestinationPort - the port to deliver the message todata - the body of the message to sendsentIntent - 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 - 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 emptypublic static SmsManager getDefault()
public boolean copyMessageToSim(byte[] smsc,
byte[] pdu,
int status)
smsc - the SMSC for this message, or NULL for the default SMSCpdu - the raw PDU to storestatus - message status (STATUS_ON_SIM_READ, STATUS_ON_SIM_UNREAD,
STATUS_ON_SIM_SENT, STATUS_ON_SIM_UNSENT)
public boolean deleteMessageFromSim(int messageIndex)
messageIndex - is the record index of the message on SIM
public boolean updateMessageOnSim(int messageIndex,
int newStatus,
byte[] pdu)
messageIndex - record index of message to updatenewStatus - new message status (STATUS_ON_SIM_READ,
STATUS_ON_SIM_UNREAD, STATUS_ON_SIM_SENT,
STATUS_ON_SIM_UNSENT, STATUS_ON_SIM_FREE)pdu - the raw PDU to store
public ArrayList<SmsMessage> getAllMessagesFromSim()
ArrayList of SmsMessage objects
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||