Android SMS monitoring sample code
This article introduces the sample code of Android monitoring mobile phone SMS and shares it with you, as follows:
The following situations may cause SMS interception failure:
Prerequisite -- permission:
Define SMS broadcast recipients
Register broadcast
Method 2: monitor SMS database
There are three external communication modes among content providers:
Method 1: it is defined as the internal class of activity and directly processes the business logic in onchang () method. For example, it is set to EditText after receiving a short message
Method 2: define the interface. The activity implements this interface, gets the callback, and processes the business logic
The code is as follows:
Method 3: Send a message through the handler and process the business logic in the activity
The code is as follows:
Registered observer
Processing messages in handler
Log off observer
remaining problems
The observer will call back onchang method () several times
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.