SmsManager
classSmsManager
kotlin.Any | |
↳ | android.telephony.gsm.SmsManager |
Manages SMS operations such as sending data, text, and pdu SMS messages. Get this object by calling the static method SmsManager.getDefault().
Summary
Constants | |
---|---|
static Int |
Generic failure cause |
static Int |
Failed because service is currently unavailable |
static Int |
Failed because no pdu provided |
static Int |
Failed because radio was explicitly turned off |
static Int |
Free space (TS 51.011 10.5.3). |
static Int |
Received and read (TS 51.011 10.5.3). |
static Int |
Stored and sent (TS 51.011 10.5.3). |
static Int |
Received and unread (TS 51.011 10.5.3). |
static Int |
Stored and unsent (TS 51.011 10.5.3). |
Public methods | |
---|---|
ArrayList<String!>! |
divideMessage(text: String!) Divide a text message into several messages, none bigger than the maximum SMS message size. |
static SmsManager! |
Get the default instance of the SmsManager |
Unit |
sendDataMessage(destinationAddress: String!, scAddress: String!, destinationPort: Short, data: ByteArray!, sentIntent: PendingIntent!, deliveryIntent: PendingIntent!) Send a data based SMS to a specific application port. |
Unit |
sendMultipartTextMessage(destinationAddress: String!, scAddress: String!, parts: ArrayList<String!>!, sentIntents: ArrayList<PendingIntent!>!, deliveryIntents: ArrayList<PendingIntent!>!) Send a multi-part text based SMS. |
Unit |
sendTextMessage(destinationAddress: String!, scAddress: String!, text: String!, sentIntent: PendingIntent!, deliveryIntent: PendingIntent!) Send a text based SMS. |
Constants
RESULT_ERROR_GENERIC_FAILURE
static valRESULT_ERROR_GENERIC_FAILURE: Int
Deprecated: Use android.telephony.SmsManager.
Generic failure cause
Value: 1
RESULT_ERROR_NO_SERVICE
static valRESULT_ERROR_NO_SERVICE: Int
Deprecated: Use android.telephony.SmsManager.
Failed because service is currently unavailable
Value: 4
RESULT_ERROR_NULL_PDU
static valRESULT_ERROR_NULL_PDU: Int
Deprecated: Use android.telephony.SmsManager.
Failed because no pdu provided
Value: 3
RESULT_ERROR_RADIO_OFF
static valRESULT_ERROR_RADIO_OFF: Int
Deprecated: Use android.telephony.SmsManager.
Failed because radio was explicitly turned off
Value: 2
STATUS_ON_SIM_FREE
static valSTATUS_ON_SIM_FREE: Int
Deprecated: Use android.telephony.SmsManager.
Free space (TS 51.011 10.5.3).
Value: 0
STATUS_ON_SIM_READ
static valSTATUS_ON_SIM_READ: Int
Deprecated: Use android.telephony.SmsManager.
Received and read (TS 51.011 10.5.3).
Value: 1
STATUS_ON_SIM_SENT
static valSTATUS_ON_SIM_SENT: Int
Deprecated: Use android.telephony.SmsManager.
Stored and sent (TS 51.011 10.5.3).
Value: 5
STATUS_ON_SIM_UNREAD
static valSTATUS_ON_SIM_UNREAD: Int
Deprecated: Use android.telephony.SmsManager.
Received and unread (TS 51.011 10.5.3).
Value: 3
STATUS_ON_SIM_UNSENT
static valSTATUS_ON_SIM_UNSENT: Int
Deprecated: Use android.telephony.SmsManager.
Stored and unsent (TS 51.011 10.5.3).
Value: 7
Public methods
divideMessage
fundivideMessage(text: String!): ArrayList<String!>!
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. |
Return | |
---|---|
ArrayList<String!>! |
an ArrayList of strings that, in order, comprise the original message |
getDefault
static fungetDefault(): SmsManager!
Deprecated: Use android.telephony.SmsManager.
Get the default instance of the SmsManager
Return | |
---|---|
SmsManager! |
the default instance of the SmsManager |
sendDataMessage
funsendDataMessage(
destinationAddress: String!,
scAddress: String!,
destinationPort: Short,
data: ByteArray!,
sentIntent: PendingIntent!,
deliveryIntent: PendingIntent!
): Unit
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 |
ByteArray!: 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 |
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"). |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if destinationAddress or data are empty |
sendMultipartTextMessage
funsendMultipartTextMessage(
destinationAddress: String!,
scAddress: String!,
parts: ArrayList<String!>!,
sentIntents: ArrayList<PendingIntent!>!,
deliveryIntents: ArrayList<PendingIntent!>!
): Unit
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<String!>!: an ArrayList of strings that, in order, comprise the original message |
sentIntents |
ArrayList<PendingIntent!>!: if not null, an ArrayList of PendingIntent s (one for each message part) that is broadcast when the corresponding message part has been sent. The result code will be Activity.RESULT_OK |
deliveryIntents |
ArrayList<PendingIntent!>!: if not null, an ArrayList of PendingIntent s (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"). |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if destinationAddress or data are empty |
sendTextMessage
funsendTextMessage(
destinationAddress: String!,
scAddress: String!,
text: String!,
sentIntent: PendingIntent!,
deliveryIntent: PendingIntent!
): Unit
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 |
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"). |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if destinationAddress or text are empty |