Joke Collection Website - Public benefit messages - What does the service mechanism in android do? Why do you need to broadcast when texting?
What does the service mechanism in android do? Why do you need to broadcast when texting?
When do you need service? For example, when playing multimedia, users start other activities. At this time, the program should continue to play in the background, such as detecting the changes of files on the SD card, or recording the changes of your geographic information location in the background. These are always hidden behind.
The essence of broadcasting is that (the sender) doesn't care what (the receiver) does when receiving the broadcast. There are all kinds of broadcasts in Android, which run in Android system. When the system/application is running, all kinds of broadcasts will register Android. When Android receives the broadcast, it will judge which broadcast needs which event, and then register the event with different applications that need the event. Different broadcasts may handle different events or the same broadcast events, so we need Android system to filter for us.
What you need to know is this method: public void send text message (string destination address, string address, string text, pending intent to send, pending intent to deliver).
Destination address: the recipient's address
SCA address:SMS center number, null is the default center number.
SentIntent: When the message is sent, broadcast the success or failure information report through PendingIntent. If this parameter is blank, the sender will be checked by all locators, which will lead to a long sending time.
DeliveryIntent: When the message is sent to the recipient, the pending content will be broadcast. The Pdu data is in the extended data ("pdu") of the status report.
If the recipient or information is empty, IllegalArgumentException will be thrown.
- Related articles
- Cold greetings and caring words in rainy days
- What is a verification code?
- How did Nike shoes come to me?
- What should I do if I forget the user password and certificate password of the tax-controlled invoicing software for VAT invoices?
- Can the secondary card see the SMS sent by the primary card?
- How to be a good bank financial manager
- How to log in to Sina Weibo with a mobile phone number?
- What business is Unicom in the letter?
- Should Yanjiao report to the community when entering Beijing?
- What if Meizu mobile phone can't turn on the phone? What if Meizu mobile phone can't turn on the phone?