Android Monitor to get SMS content of mobile phone

Source: Internet
Author: User

Android development, sometimes need to get mobile information content, there is a way to get messages sent over the monitoring method:

 Public classSmsreciverextendsbroadcastreceiver{}//2. Get SMS ContentObject[] objects = (object[]) Intent.getextras (). Get ("PDUs");//3, loop through the SMS process for(Object object:objects) {//4. Get SMS ObjectSmsmessage SMS = SMSMESSAGE.CREATEFROMPDU (byte[]) object);//5. Get basic information about the SMS ObjectString MessageBody =sms.getmessagebody ();/*I've got a text message here, and then there's the logic that I want to implement .*/}}

The mechanisms involved in the security of mobile phones are certainly not authorized, the following permissions:

<android:name= "Android.permission.RECEIVE_SMS"/><  android:name= "Android.permission.READ_SMS"/>

When you get here, don't forget to register for the broadcast, how to register according to the name of your package, I believe we all know

Android Monitor to get SMS content of mobile phone

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.