The system intercepts notifications from text messages.

Source: Internet
Author: User
There are several key points to intercept text messages:
1) Android receives text messages in broadcast mode.
2) The program only needs to add the "receive" SMS permission to its manifest. xml file.
<Uses-Permission Android: Name = "android. Permission. receive_sms"> </uses-Permission>
3) Write a broadcast receiving class.
Public class smsreceiveandmask extends broadcastreceiver {
Private string tag = "smsreceiveandmask ";
@ Override
Public void onreceive (context, intent ){

}
4) intent-filter should be added to the receiver tag of manifest. XML, and action is
<Action Android: Name = "android. provider. telephony. sms_received"/>
5) It is important to add the priority on the intent-filter so that you can receive the SMS messages first than the system or other software.
<Cycler Android: Name = ". smsreceiveandmask">
<Intent-filter Android: Priority = "1000">
<Action Android: Name = "android. provider. telephony. sms_received"/>
</Intent-filter>
</Cycler>
6) when your program receives the SMS to be blocked, use this. abortbroadcast (); to end broadcasting and send it to other programs, so that the system will not receive text message broadcast and notification will not prompt

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.