| java.lang.Object | |
| ↳ | android.telephony.SmsManager | 
       Manages SMS operations such as sending data, text, and pdu SMS messages.
 Get this object by calling the static method
       
        
         getDefault()
        
       
       .
      
       For information about how to behave as the default SMS app on Android 4.4 (API level 19)
 and higher, see
       
        
         Telephony
        
       
       .
      
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| int | RESULT_ERROR_GENERIC_FAILURE | Generic failure cause | |||||||||
| int | RESULT_ERROR_NO_SERVICE | Failed because service is currently unavailable | |||||||||
| int | RESULT_ERROR_NULL_PDU | Failed because no pdu provided | |||||||||
| int | RESULT_ERROR_RADIO_OFF | Failed because radio was explicitly turned off | |||||||||
| int | STATUS_ON_ICC_FREE | Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). | |||||||||
| int | STATUS_ON_ICC_READ | Received and read (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). | |||||||||
| int | STATUS_ON_ICC_SENT | Stored and sent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). | |||||||||
| int | STATUS_ON_ICC_UNREAD | Received and unread (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). | |||||||||
| int | STATUS_ON_ICC_UNSENT | Stored and unsent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). | |||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 
          | 
        
          
          Divide a message text into several fragments, none bigger than
 the maximum SMS message size.
          
         | 
       ||||||||||
| 
          | 
        
          
          Get the default instance of the SmsManager
          
         | 
       ||||||||||
| 
          | 
        
          
          Send a data based SMS to a specific application port.
          
         | 
       ||||||||||
| 
          | 
        
          
          Send a multi-part text based SMS.
          
         | 
       ||||||||||
| 
          | 
        
          
          Send a text based SMS.
          
         | 
       ||||||||||
| 
         
          [Expand]
         
          
          Inherited Methods
          
         | 
       |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
         
           
         
         From class
         
          java.lang.Object
         
          | 
       |||||||||||
Generic failure cause
Failed because service is currently unavailable
Failed because no pdu provided
Failed because radio was explicitly turned off
Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
Received and read (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
Stored and sent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
Received and unread (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
Stored and unsent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
Divide a message text into several fragments, none bigger than the maximum SMS message size.
| text | the original message. Must not be null. | 
|---|
           ArrayList
          
          of strings that, in order,
   comprise the original message
         | IllegalArgumentException | if text is null | 
|---|
Get the default instance of the SmsManager
Send a data based SMS to a specific application port.
         
          Note:
         
         Using this method requires that your app has the
         
          
           SEND_SMS
          
         
         permission.
        
| destinationAddress | the address to send the message to | 
|---|---|
| scAddress | is the service center address or null to use the current default SMSC | 
| destinationPort | the port to deliver the message to | 
| data | the body of the message to send | 
| sentIntent | 
           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
           
           For 
            RESULT_ERROR_GENERIC_FAILURE
           
           the sentIntent may include
  the extra "errorCode" containing a radio technology specific value,
  generally only useful for troubleshooting.
           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 | 
           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").
           | 
         
| IllegalArgumentException | if destinationAddress or data are empty | 
|---|
         Send a multi-part text based SMS.  The callee should have already
 divided the message into correctly sized parts by calling
         
          divideMessage
         
         .
        
         
          Note:
         
         Using this method requires that your app has the
         
          
           SEND_SMS
          
         
         permission.
        
         
          Note:
         
         Beginning with Android 4.4 (API level 19), if
         
          and only if
         
         an app is not selected as the default SMS app, the system automatically
 writes messages sent using this method to the SMS Provider (the default SMS app is always
 responsible for writing its sent messages to the SMS Provider). For information about
 how to behave as the default SMS app, see
         
          
           Telephony
          
         
         .
        
| destinationAddress | the address to send the message to | 
|---|---|
| scAddress | is the service center address or null to use the current default SMSC | 
| parts | 
           an
           
            ArrayList
           
           of strings that, in order,
   comprise the original message
           | 
         
| sentIntents | 
           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
           
           for success,
   or one of these errors:
           
            RESULT_ERROR_GENERIC_FAILURE
           
           
            RESULT_ERROR_RADIO_OFF
           
           
            RESULT_ERROR_NULL_PDU
           
           For 
            RESULT_ERROR_GENERIC_FAILURE
           
           each sentIntent may include
   the extra "errorCode" containing a radio technology specific value,
   generally only useful for troubleshooting.
           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.  | 
         
| deliveryIntents | 
           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").
           | 
         
| IllegalArgumentException | if destinationAddress or data are empty | 
|---|
Send a text based SMS.
         
          Note:
         
         Using this method requires that your app has the
         
          
           SEND_SMS
          
         
         permission.
        
         
          Note:
         
         Beginning with Android 4.4 (API level 19), if
         
          and only if
         
         an app is not selected as the default SMS app, the system automatically
 writes messages sent using this method to the SMS Provider (the default SMS app is always
 responsible for writing its sent messages to the SMS Provider). For information about
 how to behave as the default SMS app, see
         
          
           Telephony
          
         
         .
        
| destinationAddress | the address to send the message to | 
|---|---|
| scAddress | is the service center address or null to use the current default SMSC | 
| text | the body of the message to send | 
| sentIntent | 
           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
           
           For 
            RESULT_ERROR_GENERIC_FAILURE
           
           the sentIntent may include
  the extra "errorCode" containing a radio technology specific value,
  generally only useful for troubleshooting.
           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 | 
           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").
           | 
         
| IllegalArgumentException | if destinationAddress or text are empty | 
|---|