Android_mms text message receiving process

Source: Internet
Author: User

The framework sends the broadcast "android. provider. telephony. sms_received"

--------------------------------------- Privilegedsmsreceiver ---------------------

In this case, privilegedsmsreceiver receives the broadcast and calls the onreceivewithprivilege () method of the parent class smsreceiver.

Obtain a wake lock in this method and start the smsreceiverservice.

--------------------------------------- Smsreceiverservice ------------------------

After the service is started, the onstartcommand method is called. This method sends a message using the OBJ with the previous intent as the message.

Use intent in the handlemessage method to determine and then perform corresponding operations, such as handlesmssent, handlesmsreceived,

Handlebootcompleted, handleservicestatechanged

Execute the handlesmsreceived method when receiving the text message.

In this method, the intents. getmessagesfromintent (intent) method is used to retrieve the message [] From the intent.

Then, use the insertmessage (this, MSGs) method to insert the insertmessage message and call the storemessage method.

The storemessage method executes the values. Put (inbox. Body, SMS. getdisplaymessagebody () method

The text message is inserted into the database in the form of contentvalues.

If the insertmessage method is successfully inserted, the system will return the URI of the inserted text message. If the URI is not null, it indicates that it has been inserted into the database.

Execute messagingnotification. updatenewmessageindicator (this, true );

This method will trigger a tone or vibrate based on the status of the SMS, or you can set the notification

Since then, a new message has been successfully accepted.

 

All messages in the text message are sent through notification. Therefore, when the notification vibration is disabled and set to mute,

it is useless to set the prompt mode in the text message settings. Because the text message prompt is a common notification

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.