Archive

Prey for iOS: The inner workings

Prey is now available for iPhones and iPads at the App Store. Open source, for free, tested and ready to kick some burglar butt. Here’s a detailed explanation of how the iOS client actually works.

November 18, 2011

Months ago, when we began drawing sketches, trying to imagine what the iPhone client for Prey would look like, well it sure looked easy-peasy. It really did. But when we actually put our hands into it, we bumped into a number of things we had to sort out to make Prey work the way we wanted to, and of course, without breaking any of Apple's rules. So it took longer than expected but the work is now done, and the wait finally over.

Prey is now availablefor iPhones and iPads at the App Store. Open source, for free, tested and ready to kick some burglar butt. Check it out.

As you may know, theAndroid clienthas a few differences with the one for desktops and laptops, mainly regarding the activation system (PC's check with the server, while Androids wait for the activation SMS). On iOS the approach is a mixture of both, as iOS doesn't provide a way for apps to make use of the iPhone's SMS system as Android does.

Here's a detailed explanation of how the iOS client actually works.

Keeping the bird watchful

The first thing that Prey does after being installed on a device, is to add a hook for iOS' Significant Location Change (SLC) service. This provides a way for Prey to be woken up when needed,using the least possible amount of battery.

What the SLC service does, internally, is to instruct the phone or tablet to poke Prey every time it connects to a different cell antenna. Once Prey receives that poke, it will ask the Control Panel about its status, very much like the desktop and laptop version does using Cron or CronSVC.

What comes next, you already know: if the device is marked as missing, Prey will begin to send new reports. If it isn't, it will simply go back to sleep and wait until it is poked again, when the phone connects to another cell antenna.

So, the first difference with the laptop/desktop version is that on iOSthe delay between reports and actions isn't a fixed, regular interval, but rather a semi random one which is triggered when phones move from one location to another. Pro users, however, do haveOn-Demand activationavailable in the Control Panel, that activates Prey in a glimpse without having to wait. Just as it works on PCs and Android devices.

Of course, regardless of the way you sent the signal -- either pull (interval) or push (On-Demand) --Prey will send reports until the device is unflagged as missing in the Control Panel.

The main reason why Prey uses the SLC listener from iOS is simple: if it didn't, it would need to be opened by the person holding the device in order to work. This way, Prey can run silently in the background, without giving any indication to the guy who took your phone that he's being chased.

By the way, the SLC service, as well as support for background apps, was added on iOS 4.0, so unfortunately Prey won’t work on older versions of iOS. So if you're running an earlier version then it may be time to update!

Geo module accuracy

On iOS devices, Prey's Geo module includes an accuracy option that defines the frequency it will poll iOS for a new geolocation fix. As you may imagine, more accuracy means more battery consumption, but also a higher level of precision about your phone's current location.

We suggest you try different options, so you get a better idea of the level of accuracy and the delay between reports. This is important because when setting the accuracy to the lowest level, Prey may not get a new fix from the iOS in a while so reports may take longer to arrive than expected. In the end, it all depends on how fast the person holding the phone moves around.

Front-facing camera support

Yup, that's right! If your iPhone or iPad has a front-facing camera then you'll be happy to know that Prey's iOS client supports it. This is how it works.

As soon as you push the On-Demand button, a predefined message will be displayed on your device (like the one on the right). Once the thief moves the slider, Prey will take a picture using the built-in camera, while a random bank page is opened showing a "Loading" message. This way we can get the thief's attention so that he looks right into the camera lens when the picture is taken!

Unfortunately,Apple only allows the use of the camera when the application is running on the foreground, so the webcam module won't work if the application is sent to the background. Bummer, I know.

In other words, if you're not a Pro user you'll need the app to be running in the foreground for the Webcam module to work (i.e. the user must tap the Prey icon on the phone, which is not likely to happen). If you are Pro, however, you'll be able to send the On-Demand, push notification that, if opened,will raise the app to the foreground.

The bottom line is that if you want to take pictures remotely, you'll probably want to upgrade to Pro. :)

Camouflage mode

Oh yes, almost forgot about this. If you installed the app on your device then you probably saw an option called Camouflage Mode. When Camouflage is enabled, a random image is shown instead of the Prey logo when the app's icon is tapped by the user. This is just to trick the guy into thinking that Prey is a game and not the reason for his future arrest!

We'd love to be able to hide the Prey icon altogether, but unfortunately, that's not possible on iOS. However, what you can -- and probably should -- do is to move the Prey icon into one of iOS's subfolders (like Utilities, which includes the Clock and Calculator). This way the thief won't notice the application at a first glance.

Thanks beta testers

Last but not least, we'd like to thank everyone who helped us test and debug the iOS version since its early days. As promised the code is available in our repository so feel free to fork away and send pull requests. We want to build the best way for keeping track of your phone, tablet, or laptop and we know thatopenness is the way.

So that's it -- happy hunting guys. Enjoy the app and don't forget to submit reviews through the App Store!

On the same Issue

Official Statement Regarding Malaysian PKR Election Claims

We were surprised by uninformed allegations that claimed Prey’s Anti-theft solution had taken part in the tampering of e-voting tablet devices. Here is our statement.

November 12, 2018
keep reading
Doing Customer Support Right: The Prey Way

Here’s the first of several blog entries telling about our company’s inner workings: How we nailed customer satisfaction making it one of our core values.

June 20, 2015
keep reading
Prey On-Demand now available for all mobiles

Good news everyone! You can now use Prey On-Demand on your iPhone, iPad or your Android phone or tablet whether you have a Pro account or not.

October 19, 2012
keep reading
It's official: Prey is now on Ubuntu and Debian

Good news Ubuntu users! If you already upgraded to Ubuntu Natty Narwhal (11.04) then you’ll be able to install Prey directly from Ubuntu’s official package repositories.

April 29, 2011
keep reading