Android project realizes blacklist interception effect
This paper describes the implementation method of blacklist in Android programming. Share with you for your reference, as follows:
1. Create blacklist database
Three fields (_idself growth field phone blacklist number mode interception type)
SQL statement to create table
Combined with the project, create the database and corresponding tables
2.BlackNumberDao
Blacknumberdao singleton mode
3. Load more trigger conditions
After loading the data of the next page, it needs to be added to the back of the data of the previous page
4. Intercept SMS
When the SMS is received, the broadcast is sent, the broadcast receiver is monitored, the SMS is intercepted (orderly) and the priority level of the broadcast is raised to the highest (1000)
5. Intercept calls
A call is dialed in and is in the ring state. In the ring state, the code is used to hang up the phone (Aidl, reflection), and the method of intercepting the phone to hang up the phone number is placed in the Aidl file with the name endcall
Check the telephonemanager source code here to find the method to get the itelephony object
The servicemanager class Android is hidden from developers, so its methods cannot be called directly, so it needs to be called by reflection
BlackNumberService
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.