SMS bug of android content observer,

Source: Internet
Author: User

SMS bug of android content observer,
Steps:
1. Get the content observer ContentResolver contentResolver = getContentResolver ();
2. Register and observe the observed content (that is, add the observer in the android text message)
// Uri Short Message Address // true indicates that the SMS address meets the requirements. false indicates that the Message address must be exactly the same. // Add the observer. What is the Uri uri = Uri. parse ("context: // sms/"); // sms contentResolver. registerContentObserver (uri, true, new MyObserver (new Handler (); 3. specific observer private class MyObserver extends ContentObserver {
Public MyObserver (Handler handler) {super (handler );}
/*** This method is called when the content observes that the database has been updated * that is, it will be known when a new text message is updated */
@ Overridepublic void onChange (boolean selfChange) {super. onChange (selfChange); Toast. makeText (MainActivity. this, "message content prompts", Toast. LENGTH_SHORT ). note: In the onChange () method, you can write some text message content, send it to your server, and send a message to yourself from the server, in this way, the text message is eavesdropped, but the user's privacy is Snoop, so you don't mind using it.

Related Article

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.