Service Management class-----Smsmanager

Source: Internet
Author: User

Smsmanager Public methods:

  • ARRAYLIST< string >&NBSP; dividemessage (String text)   When the SMS exceeds the maximum length of the SMS message, divide the text message into chunks.   parameters: text--initial message, cannot be empty   return value: Ordered arraylist< string>, can be re-assembled as the initial message
  • Static  smsmanager getdefault () Gets the default instance of Smsmanager. return value:default instance of Smsmanager
  • void Senddatamessage (String destinationaddress, String scaddress, Short Destinationport, byte[] Data,pendingintent sentintent,pendingintent deliveryintent)Sends an SMS-based data to the specified application port.Parameters: 1),destinationaddress--the destination address of the message 2),scaddress--the address of the service center or null use the current default of SMSC 3)destinationport--The target port number of the message 4), thedata--message body, which is the message to send data 5),sentintent--if not empty, when the message successfully sent or failed this pendingintent broadcast. 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, usually only useful in repairing a failure. Each SMS-based application controls the detection of 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 not empty, when the message is successfully transmitted to the receiver this pendingintent is broadcast. exception: throws an IllegalArgumentException exception if destinationaddress or data is empty.
  • voidSendmultiparttextmessage (String destinationaddress, String scaddress, ArrayList<String>Parts, ArrayList<pendingintent> sentintents, ArrayList<pendingintent>deliverintents)Sends an SMS-based multipart text that the caller app has passed by callingDividemessage (String text) splits the message into the correct size.Parameters: 1),destinationaddress--message Destination address   2), arraylist<string , can be re-assembled as initial messages   4), sentintents--and senddatamessage method, but here is a set of pendingintent  5), deliverintents--and senddatamessage method, but here is a set of pendingintent  data is empty when the IllegalArgumentException exception is thrown.
  • 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 PDU is not provided with a value of 3 (0x00000003)
  • public static final int Result_error_radio_off indicates that the wireless broadcast 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 with a value of 1 (0x00000001)
  • public static final int Status_on_icc_sent represents the store and has been sent with a value of 5 (0x00000005)
  • public static final int Status_on_icc_unread = received but unread with a value of 3 (0x00000003)
  • public static final int Status_on_icc_unsent represents a store but is sent with a value of 7 (0x00000007)

Service Management class-----Smsmanager

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.