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