If you have a smartphone, surely you covet it’s presence and usage. It probably doesn’t leave your sight very often, and losing it would be a huge inconvenience to you, perhaps almost disastrous. Thankfully, there’s a slew of services out there that help you locate your lost or stolen device, remote wipe it, etc. in case this happens. I’m going to highlight one more tool available to you in your smartphone arsenal that can help you keep tabs on your device. Also, this tool can be used for quite a bit more than security. Since this is a linux blog, of course I’m going to be talking about the android platform 🙂 .
Tasker is an automation application that’s available for Android. Think of it as an automation language for your smartphone. From settings to states and events, Tasker allows you to setup rules and logic to handle common tasks that you may want to automate, or integrate together. If you’re familiar with IFTTT think of it as IFTTT for your phone. One of the recipes I’ve been meaning to setup for a while (a recipe or profile is the term used to group rules and logic together) is to detect when someone enters my PIN or PATTERN code incorrectly, have a photo of them taken discreetly, and then email it to me with the phone’s GPS location. This gives me a picture of the potential thief, as well as the location of my phone should I ever lose it. This is something I could provide to authorities to help recover the device, or at least see which friend/child has “borrowed” my phone for mischief. 🙂
I have a Samsung Galaxy S4 running CyanogenMod11, which is Android KitKat v 4.4.4. You’ll need to install Tasker, add the Secure Settings plugin to Android, install SL4A (Scripting Layer for Android), install Python, and have this script in your /sdcard/sl4a/scripts/ directory. Tasker has a wiki and further details on how to do this if you have questions. I had some troubles locating these .apk files as the SL4A project has recently moved from Google Code. I’ve linked them here for your convenience, but you could download from a more *trusted* source if you’d rather 🙂 . Once those items are installed from Google Play, you’ll want to open Python and follow the prompts to complete installing the modules. You should end up being able to run SL4A and see a few scripts in it’s list, one of them being sendemailA.py:
From here, you’re ready to open Tasker, and create the profile. The Tasker wiki has pre-built profiles you can either use directly, or slightly modify for your own use. I used both of these profiles to create mine. The first, failed login photo, and the second, automatically take and email your photo. At this point, you’ll be creating your first Tasker profile, associating Actions with it, and creating/setting a few variables. Don’t worry, this is pretty easy to do, you don’t need any programming experience. Here is what my Tasker profile looks like. I’ve removed my personal values in the variables, these will be substituted for your own:
You can hit the play button at the bottom left to test your recipe. This is what my final product looks like… After 3 failed login attempts, I’m emailed a photo of the intruder (me in this case!), with a link to my phone’s GPS location transposed onto Google Maps: