Recommended reading:
An analysis of Android phone defender SIM card binding
An in-depth analysis of the Android phone defender MD5 encryption when saving passwords
Detailed Android Phone Guardian Settings Wizard page
An analysis of Android phone defender turn off automatic Updates
A brief analysis of Android phone defender custom control properties
An analysis of Android phone defender reading contacts
Through the broadcast receiver, receive the text message, the message content to judge, if we specify the value to perform the appropriate action.
If the message content is "#*location*#" on the execution, get the phone location
If the message content is "#*alarm*#" on the execution, play the alarm music
If the message content is "#*wipedata*#" to execute, remotely erase data
If the message content is "#*lockscrreen*#" on the execution, Remote lock screen
Define the priority of SMS as 1000
Use the simulator to send a short coupon, will automatically send the number stitching 155xxxx, and so on, the judgment time will be inaccurate, using the String object contains () method to determine whether to include our saved security number
Create the Raw folder in the Res directory and put the music files in
Call Mediaplayer.create () method, get MediaPlayer object, Parameter: Context, resource file
Note that the resource file R is in the package and do not lead to a system
Call the Start () method of the MediaPlayer object
The alarm that is played at this point does not work because it works if the target phone is listening to music tuned to multimedia.
Smsreceiver.java
Package com.qingguow.mobilesafe.receiver;
Import COM.QINGGUOW.MOBILESAFE.R;
Import Android.content.BroadcastReceiver;
Import Android.content.Context;
Import android.content.Intent;
Import android.content.SharedPreferences;
Import Android.media.MediaPlayer;
Import Android.telephony.SmsMessage;
Import Android.widget.Toast; public class Smsreceiver extends Broadcastreceiver {private sharedpreferences sp; @Override public void onreceive (context Context, Intent Intent) {sp=context.getsharedpreferences ("config", context.mode_private);//Get SMS Content object[] objs= (
Object[]) Intent.getextras (). Get ("PDUs");
for (Object obj:objs) {smsmessage SMS=SMSMESSAGE.CREATEFROMPDU ((byte[)) obj);
String Body=sms.getmessagebody ();
String sender=sms.getoriginatingaddress ();
String secsender=sp.getstring ("Secphone", ""); Judge is the security number of the SMS if (secsender.equals (sender)) {switch (body) {case "#*alarm*#"://Send Alarm music//toast.maketext (context, "play alarm music
", 1). Show ();
MediaPlayer mp=mediaplayer.create (context, r.raw.alarm); Mp.starT ();
Abortbroadcast ();
Break
Default:break; }
}
}
}
}
The above is a small set to introduce the Android phone guards to receive SMS instructions to carry out the corresponding operation of the relevant knowledge, hope that the above help!