Android customization – Device security, intrusion detection using Tasker

by: Jonathan FeistJanuary 8, 2015
445

Tasker Intruder security detection photo capture

Last week in our Android customization series, we looked at clearing device cache and wiping out the somewhat overloaded photo thumbnail cache on your Android device. These actions will be valuable if you follow along today.

Today we are looking at creating custom device security using Tasker, the idea is simple, we’ll show you how to make your device take a photo of any person accessing your phone. As a bonus, we’ll make sure the device location is saved in the name of the image file.

Before we get started

Get it on Google Play ButtonTo follow along today, you’ll need to have Tasker installed on your device. Tasker is $2.99 in the Google Play Store. Further, you are going to want to have a device with a front facing camera, but we can get by without, if you need.

Let me explain again what we are up to, we are looking at security here today. We want to capture an image of anyone that turns on the display of your device. Then we save the current GPS coordinates, as well as the date and time, as a part of the image file name.

Tasker Intruder Security Front Cam

Let’s do this. Open up Tasker and head to the Tasks tab. We will start by creating a variable that includes the device location, then we’ll take the photo.

Create a new Task, name it concisely and uniquely, I’ll call mine “SecurityPic“.

Tap the “+” button to add a new Action.

Tasker Intruder security Task variable set

Select Variables.

Select Variable Set.

In the Name field, create a local variable to the GPS coordinates. I entered “%securegps“.

In the To field, tap the label icon and look for Location, or just enter “%LOC“.

Tap the system Back button to save and exit.

Truth is, only storing the GPS location in the variable is a bit of a waste. I used a variable here so that you can easily include more information in your save file. Tasker will cover the date and time, but you may add battery level, keylock status, and so much more.

Tap the “+” button to add your next Action.

Tasker Intruder security Task take photo

Select Media.

Select Take Photo.

Under Camera, choose Front.

Under Filename, tap the labels icon and choose your location variable. Or just enter it manually, mine was “%securegps“.

Under Naming Sequence, choose Chronological. This is where it adds the date and time.

De-select the check box to turn off Insert In Gallery.

Select the check box to turn on Discreet. This makes it so that the photo app does not display on the screen, taking the photo in the background.

Feel free to change the Resolution if you desire.

If you see the option called Flash Mode, I suggest turning it off.

Hit the system Back button to save and exit, then hit it again to exit out of the Task.

Tasker Intruder security Tasks overview

Now that we have our Task in place, we need to decide how and when to use it. That is a simple decision based on the goal of our project today. So, head on over to the Profiles tab so we can set the trigger for our picture taking Task.

Tap the “+” to add a new Profile.

Name it uniquely and concisely, I called mine “SecurityCam“.

Tasker Intruder security Profile Display

Select Event.

Select Display.

Select Display On. (You could select Display Unlocked, if you suspect your device is being accessed by someone who knows your unlock code/pin/pattern.)

Tap the system back button to save and exit.

From the list of available Tasks, choose your security cam Task, mine was called “SecurityPic“.

That is all there is too it. From here on out whenever your device is turned on (or unlocked) your device will take a quick snapshot of the user accessing it. These photos will be saved in the DCIM/Tasker folder. So be sure to head in there frequently to clean out, if needed.

What’s next

This is obviously not a great Tasker Profile to have running full time, unless you like to see hundreds of awkward photos of yourself, so we should look at creating a trigger to turn on the Profile when needed.

For these purposes, I would like to use a SMS trigger. This really should be a tutorial all its own, but let’s do it.

Tasker Intruder security SMS Task start Profile

Create a new Task, name it something like “StartSecurityCam“. Create your task, hit the “+” button, choose Tasker -> Profile Status, tap the label icon beside Name and choose your SecurityCam Profile. Set Set to On. You’re finished here.

Tasker Intruder security Profile SMS

Create your Profile, name it as needed. Select Event -> Phone -> Received Text. Although you can mess with the details here, I would recommend simply entering a secret code into the Content field. Keep in mind that if your phone is lost and in the hands of an intruder, they will see this message, so enter something truly unique and inconspicuous. I have entered “Is this HAL?

Hit the system Back button to exit out, then choose your “StartSecurityCam” Task from the previous step.

What you do now is turn off the SecurityCam Profile. When your device is lost, stolen or you suspect someone is tapping into it behind your back, find a service or another phone to send yourself a text. Be sure to enter the exact phrase entered above. When your phone receives the SMS, the SecurityCam Profile turns on and pictures begin snapping away of the person touching your phone.

Tasker Intruder security SMS starts Profile

You could also look at having your device automatically send a discreet return SMS that includes the GPS coordinates of your phone, to help find it if it is not where it should be. While it is not as easy to send the captured images of your culprit, if you make sure the folder auto-uploads images to a service like Google+ or Dropbox, you will have the date, time, GPS coordinates and a picture to take to law enforcement, or otherwise recover your phone.

Next week

Did we go overboard today with creating a security cam in our Android customization series? I hope not, and I hope that this project saves you some grief over a missing or compromised Android device. Next week, we would like to continue with the idea of recovering a lost phone – besides the lock screen contact info tutorial we had a while back, Google themselves have a tool for you, called Android Device Manager. We’ll be walking through how to set up Android Device Manager on your device, and how to use it from the web.

Do you use any similar type of security measures for your Android devices?

  • SAM

    Awesome.. I use pushbullet for activation

  • Kevin Dennis

    When I try to add a task for sms activation when I go to profile status only variables are available and not the profile I’m trying to activate.what am I doing wrong?

    • Lokesh.C

      Did you figure it out? I have the same problem. Could you help me out?

  • Alex Wu

    Is it possible to set a task that uploads the picture to a dedicated google drive folder using http post and the google drive api?

  • Jar_of_Farts

    Excellent, thank you. I was looking for exactly that unlock feature.