Smsmanager
Public Method:
- Arraylist<string> dividemessage(String text)
When the SMS exceeds the maximum length of the SMS message, divide the text message into chunks.
parameter :text--initial message, cannot be empty
return value : Ordered arraylist<string>that can be re-assembled into the initial message
- Static Smsmanager Getdefault()
Gets the default instance of Smsmanager.
return value : default instance ofSmsmanager
- void senddatamessage (String destinationaddress , string scaddress , short Destinationport , byte[] Data , pendingintent sentintent, Pendingintent deliveryintent)
sends an SMS-based data to the specified application port.
parameter :
1), destinationaddress --Destination address of Message
2), scaddress --Address of service center or empty use current default SMSC 3) Destinationport -the target port number of the message
4), data -the body of the message, the data to be sent by the message
5), sentintent --If not empty, This pendingintent is broadcast when the message is successfully sent or failed. The result code is ACTIVITY.RESULT_OK for success, or one of Result_error_generic_failure, Result_error_radio_off, and RESULT_ERROR_NULL_PDU represents an error. For Result_error_generic_failure, sentintent may include an additional "error code" that contains a radio broadcast technology-specific value that is usually only useful in repairing a failure.
Each SMS-based application control detection sentintent . If sentintent is empty, the caller will detect all unknown applications, which will cause a smaller number of SMS to be sent at the time of Detection.
6), deliveryintent --if it is not empty, the message is broadcast when it is successfully delivered to the recipient pendingintent.
Exception : Throws an IllegalArgumentException exception if destinationaddress or data is empty.
- void sendmultiparttextmessage (String destinationaddress , string scaddress , Arraylist<string>parts , arraylist<pendingintent> sentintents, arraylist< Pendingintent> deliverintents)
sends a multipart text based on SMS, and the caller app has passed the call dividemessage The (String text) splits the message into the correct size.
parameter :
1), destinationaddress --Destination address of Message
2), scaddress --Address of the service center or empty use the current default SMSC
3), parts --ordered Arraylist<string>, , can be re-assembled as initial messages
4), sentintents --followed by Senddatamessage the method, except here is a set of Pendingintent
5), deliverintents --with senddatamessage method, except that it is a set of Pendingintent
exceptions : If destinationaddress or data is empty, Throws a IllegalArgumentException exception.
- void sendtextmessage(String destinationaddress, String scaddress, string text, Pendingintent sentintent, Pendingintent deliveryintent)
Sends an SMS-based text. The meaning of the parameter is the same as the exception that existed before, no longer a statement of exhaustion.
Constant:
- public static final int Result_error_generic_failure
represents a normal error with a value of 1 (0x00000001)
- public static final int Result_error_no_service
Indicates that the service is currently unavailable with a value of 4 (0x00000004)
- public static Final int Result_error_null_pdu
Indicates that no PDU is provided, with a value of 3 (0x00000003)
- public static final int Strong>result_error_radio_off
Indicates that the radio is explicitly closed with a value of 2 (0x00000002)
- public static final int Status_on_icc_free
represents free space with a value of 0 (0x00000000)
- public static final int status_on_icc_read
means receive and read, value 1 (0x00000001)
- public static final int status_on_icc_sent
indicates storage and sent A value of 5 (0x00000005) - public static final int Status_on_icc_unread
means receive but unread with a value of 3 (0x00000003) /li> - public static final int Status_on_icc_unsent
Represents a store but is sent with a value of 7 (0x00000007) - li>
Android Learning--setcontentview () 's past life