IT. Expert System.

Android Reference

SmsManager


android.telephony

Class SmsManager



  • public final class SmsManager
    extends Object
    Manages SMS operations such as sending data, text, and pdu SMS messages. Get this object by calling the static method SmsManager.getDefault().
    • Field Detail

      • STATUS_ON_ICC_FREE

        public static final int STATUS_ON_ICC_FREE
        Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
        See Also:
        Constant Field Values
      • STATUS_ON_ICC_READ

        public static final int STATUS_ON_ICC_READ
        Received and read (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
        See Also:
        Constant Field Values
      • STATUS_ON_ICC_UNREAD

        public static final int STATUS_ON_ICC_UNREAD
        Received and unread (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
        See Also:
        Constant Field Values
      • STATUS_ON_ICC_SENT

        public static final int STATUS_ON_ICC_SENT
        Stored and sent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
        See Also:
        Constant Field Values
      • STATUS_ON_ICC_UNSENT

        public static final int STATUS_ON_ICC_UNSENT
        Stored and unsent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27).
        See Also:
        Constant Field Values
      • RESULT_ERROR_GENERIC_FAILURE

        public static final int RESULT_ERROR_GENERIC_FAILURE
        Generic failure cause
        See Also:
        Constant Field Values
      • RESULT_ERROR_RADIO_OFF

        public static final int RESULT_ERROR_RADIO_OFF
        Failed because radio was explicitly turned off
        See Also:
        Constant Field Values
      • RESULT_ERROR_NULL_PDU

        public static final int RESULT_ERROR_NULL_PDU
        Failed because no pdu provided
        See Also:
        Constant Field Values
      • RESULT_ERROR_NO_SERVICE

        public static final int RESULT_ERROR_NO_SERVICE
        Failed because service is currently unavailable
        See Also:
        Constant Field Values
      • RESULT_ERROR_LIMIT_EXCEEDED

        public static final int RESULT_ERROR_LIMIT_EXCEEDED
        Failed because we reached the sending queue limit.
        See Also:
        Constant Field Values
      • RESULT_ERROR_FDN_CHECK_FAILURE

        public static final int RESULT_ERROR_FDN_CHECK_FAILURE
        Failed because FDN is enabled.
        See Also:
        Constant Field Values
    • Method Detail

      • sendTextMessage

        public void sendTextMessage(String destinationAddress,
                           String scAddress,
                           String text,
                           PendingIntent sentIntent,
                           PendingIntent deliveryIntent)
        Send a text based SMS.
        Parameters:
        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").
        Throws:
        IllegalArgumentException - if destinationAddress or text are empty
      • divideMessage

        public ArrayList<String> divideMessage(String text)
        Divide a message text into several fragments, none bigger than the maximum SMS message size.
        Parameters:
        text - the original message. Must not be null.
        Returns:
        an ArrayList of strings that, in order, comprise the original message
        Throws:
        IllegalArgumentException - if text is null
      • sendMultipartTextMessage

        public void sendMultipartTextMessage(String destinationAddress,
                                    String scAddress,
                                    ArrayList<String> parts,
                                    ArrayList<PendingIntent> sentIntents,
                                    ArrayList<PendingIntent> deliveryIntents)
        Send a multi-part text based SMS. The callee should have already divided the message into correctly sized parts by calling divideMessage.
        Parameters:
        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 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
        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 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
      • sendDataMessage

        public void sendDataMessage(String destinationAddress,
                           String scAddress,
                           short destinationPort,
                           byte[] data,
                           PendingIntent sentIntent,
                           PendingIntent deliveryIntent)
        Send a data based SMS to a specific application port.
        Parameters:
        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").
        Throws:
        IllegalArgumentException - if destinationAddress or data are empty
      • getDefault

        public static SmsManager getDefault()
        Get the default instance of the SmsManager
        Returns:
        the default instance of the SmsManager
      • copyMessageToIcc

        public boolean copyMessageToIcc(byte[] smsc,
                               byte[] pdu,
                               int status)
        Copy a raw SMS PDU to the ICC. ICC (Integrated Circuit Card) is the card of the device. For example, this can be the SIM or USIM for GSM.
        Parameters:
        smsc - the SMSC for this message, or NULL for the default SMSC
        pdu - the raw PDU to store
        status - message status (STATUS_ON_ICC_READ, STATUS_ON_ICC_UNREAD, STATUS_ON_ICC_SENT, STATUS_ON_ICC_UNSENT)
        Returns:
        true for success
        Throws:
        IllegalArgumentException - if pdu is NULL
      • deleteMessageFromIcc

        public boolean deleteMessageFromIcc(int messageIndex)
        Delete the specified message from the ICC. ICC (Integrated Circuit Card) is the card of the device. For example, this can be the SIM or USIM for GSM.
        Parameters:
        messageIndex - is the record index of the message on ICC
        Returns:
        true for success
      • updateMessageOnIcc

        public boolean updateMessageOnIcc(int messageIndex,
                                 int newStatus,
                                 byte[] pdu)
        Update the specified message on the ICC. ICC (Integrated Circuit Card) is the card of the device. For example, this can be the SIM or USIM for GSM.
        Parameters:
        messageIndex - record index of message to update
        newStatus - new message status (STATUS_ON_ICC_READ, STATUS_ON_ICC_UNREAD, STATUS_ON_ICC_SENT, STATUS_ON_ICC_UNSENT, STATUS_ON_ICC_FREE)
        pdu - the raw PDU to store
        Returns:
        true for success
      • getAllMessagesFromIcc

        public static ArrayList<SmsMessage> getAllMessagesFromIcc()
        Retrieves all messages currently stored on ICC. ICC (Integrated Circuit Card) is the card of the device. For example, this can be the SIM or USIM for GSM.
        Returns:
        ArrayList of SmsMessage objects
      • enableCellBroadcast

        public boolean enableCellBroadcast(int messageIdentifier)
        Enable reception of cell broadcast (SMS-CB) messages with the given message identifier. Note that if two different clients enable the same message identifier, they must both disable it for the device to stop receiving those messages. All received messages will be broadcast in an intent with the action "android.provider.Telephony.SMS_CB_RECEIVED". Note: This call is blocking, callers may want to avoid calling it from the main thread of an application.
        Parameters:
        messageIdentifier - Message identifier as specified in TS 23.041
        Returns:
        true if successful, false otherwise
        See Also:
        {@hide}
      • disableCellBroadcast

        public boolean disableCellBroadcast(int messageIdentifier)
        Disable reception of cell broadcast (SMS-CB) messages with the given message identifier. Note that if two different clients enable the same message identifier, they must both disable it for the device to stop receiving those messages. Note: This call is blocking, callers may want to avoid calling it from the main thread of an application.
        Parameters:
        messageIdentifier - Message identifier as specified in TS 23.041
        Returns:
        true if successful, false otherwise
        See Also:
        {@hide}
      • enableCellBroadcastRange

        public boolean enableCellBroadcastRange(int startMessageId,
                                       int endMessageId)
        Enable reception of cell broadcast (SMS-CB) messages with the given message identifier range. Note that if two different clients enable the same message identifier, they must both disable it for the device to stop receiving those messages. All received messages will be broadcast in an intent with the action "android.provider.Telephony.SMS_CB_RECEIVED". Note: This call is blocking, callers may want to avoid calling it from the main thread of an application.
        Parameters:
        startMessageId - first message identifier as specified in TS 23.041
        endMessageId - last message identifier as specified in TS 23.041
        Returns:
        true if successful, false otherwise
        Throws:
        IllegalArgumentException - if endMessageId < startmessageid
        See Also:
        disableCellBroadcastRange(int, int)
      • disableCellBroadcastRange

        public boolean disableCellBroadcastRange(int startMessageId,
                                        int endMessageId)
        Disable reception of cell broadcast (SMS-CB) messages with the given message identifier range. Note that if two different clients enable the same message identifier, they must both disable it for the device to stop receiving those messages. Note: This call is blocking, callers may want to avoid calling it from the main thread of an application.
        Parameters:
        startMessageId - first message identifier as specified in TS 23.041
        endMessageId - last message identifier as specified in TS 23.041
        Returns:
        true if successful, false otherwise
        Throws:
        IllegalArgumentException - if endMessageId < startmessageid
        See Also:
        enableCellBroadcastRange(int, int)


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 438 / 158861711. Delta: 0.04461 с