public class SmsManager
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static SmsManager |
getDefault()
Get the default SmsManager.
|
void |
registerSmsReceiver(SmsReceiver receiver)
Registers a receiver to listen for incoming text sms messages
|
void |
registerSmsReceiver(SmsReceiver receiver,
int port)
Registers a receiver to listen for incoming sms messages
|
void |
sendDataMessage(java.lang.String destinationAddress,
java.lang.String scAddress,
int port,
byte[] data)
Send a data based SMS to a specific application port.
|
void |
sendTextMessage(java.lang.String destinationAddress,
java.lang.String scAddress,
java.lang.String text)
Send a text based SMS.
|
public static SmsManager getDefault()
public void registerSmsReceiver(SmsReceiver receiver, int port)
receiver - the receiver that will handle incoming sms messages or null to stop listening
incoming messagesport - the port to listen for incoming sms messages - required for data sms messages, pass -1 to listen on default port for text messagespublic void registerSmsReceiver(SmsReceiver receiver)
receiver - the receiver that will handle incoming text sms messages or null to stop listening
incoming messagespublic void sendTextMessage(java.lang.String destinationAddress,
java.lang.String scAddress,
java.lang.String text)
destinationAddress - the address to send the message toscAddress - the service center address or null to use the current default SMSCtext - the body of the message to sendpublic void sendDataMessage(java.lang.String destinationAddress,
java.lang.String scAddress,
int port,
byte[] data)
destinationAddress - the address to send the message toscAddress - the service center address or null to use the current default SMSCport - the port to deliver the message todata - the body of the message to send