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