On the Android handset Guardian receives the short message instruction to carry on the corresponding operation _android

Source: Internet
Author: User
Tags md5 encryption

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!

Related Article

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.