TUAW Responds: iPhone LoJack
Way back, one of our readers begged for an iPhone LoJack solution. He wanted his iPhone to "call home" regularly in case of loss or, let's be more realistic, theft. Over the past week, I finally had a chance to give this request some time, and I put together findme. It's a command-line program that returns the location of the cell phone tower nearest to your iPhone. When run, it tells you the tower id, plus its latitude and longitude courtesy of Google Maps.
Still, how to get the location report to a place you can get it... but nobody else can... and without receiving a zillion SMSes? For this part of the puzzle, enter Twitter. Twitter dev Britt Selvitelle helped walk me through the setup for a private account that allows your iPhone to phone home but keeps the location data relatively secure.
To do this, create a new Twitter account just for your iPhone (it will need its own unique email address, separate from your main account, so have one handy). Open the Settings panel, and look for the "Protect My Updates" checkbox. It's towards the bottom of the page, just above the Save button. Check this and click Save. With protected updates, only the Twitter users you approve will see the updates for this iPhone-only account (just you? you + spouse? spouse, kids, and "special friends?" Up to you).
Update: I've put an updated version of findme (findme-better) into the TUAW folder on my site. Please let me know if this works better for location for you. To use, just copy to your iPhone (you may have to use Firefox if you get errors after downloading with Safari), rename to "findme" and replace the original findme.
After creating your phone's Twitter account, you're ready to set up your iPhone to tweet in on a regular basis. Here's how.
1. Install findme Add findme to your local binaries folder. Under 1.1.3, I've been using /var/root/bin for my utilities. If you use another location, substitute that path for mine. Make sure to chmod 755 findme so that it can be executed.
2. Make sure you have curl It's a standard part of the BSD distribution, if memory serves. You'll need it to contact Twitter. Your iPhone will only be able to call in via curl and Twitter if it has Internet access, through EDGE or WiFi.
3. Create a tweet shell script Copy the following text into a new text file, and add it to your binaries folder.
#! /bin/sh
curl --basic --user username:password \
--data status="`/var/root/bin/findme`" \
http://twitter.com/statuses/update.xml
Use the proper path to findme and substitute your actual username and password. Make the file executable, i.e.
chmod 755 tweet
4. Create a launch daemon In /System/Library/LaunchDaemons, you'll find a simple daemon that runs once a day, called com.apple.daily.plist. Copy this to com.sadun.tweet.plist, and edit it as follows:
- Update the Label to com.sadun.tweet.
- Kill the two lines that relate to "nice". You don't want your lojack to be usurped by other processes.
- Change the program arguments to /var/root/bin/tweet.
- Change the start interval from 86400, according to your needs. 86400 is once a day (60 seconds * 60 minute * 24 hours). Right now, I have mine running every ten minutes (600) because I needed to check that the LaunchDaemon was functioning properly.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.sadun.tweet</string>
<key>ProgramArguments</key>
<array>
<string>/var/root/bin/tweet</string>
</array>
<key>StartInterval</key>
<integer>600</integer>
</dict>
</plist>
5. Reboot. This allows our iPhone to restart, loading your new launch daemon.
The findme software was written around material orginated by the iPhone dev team and by Hisper of the Google Maps online developer forum, and was helped by Saurik -- because the iPhone's built in host name resolution is horrible. Thanks also to aCujo for his help. The Twitter curl calls are courtesy of Britt's brilliant assistance. You can drop him a note to say thank you. Thanks also go to Mike Rose, whose idea it was to use Twitter instead of SMS.
Tip: If you find that your tweets are full of "Location Not Found" messages, edit the tweet shell script and duplicate the curl call. This runs the call twice. Usually the "Location Not Found" message goes away the second time.
Another Tip: If you're traveling across the country, change your start interval to 15 minutes or a half hour and use a public Twitter account. (Remember to reboot after making changes to the Launch Daemon). Your friends will be able to track your progress using the Google Maps URL that's tinyURL'ed into each tweet.
Enjoy your newfound location awareness!
Share
Source: http://ericasadun.com/ftp/TUAW/
Way back, one of our readers begged for an iPhone LoJack solution. He wanted his iPhone to "call home" regularly in case of loss or, let's...
Add a Comment
Where can I find a detail instruction on how to install findme on my iphone?
April 18 2008 at 1:26 AM Report abuse Permalink rate up rate down Replyi can not create de plist file y have this message when i create the file
scp: /System/Library/LaunchDaemons/com.sadum.tweet.plist: No space left on device
give me some tips the made it work please...
I lost my first iphone on a school bus. I was crushed and devastated. My brother surprised me with a new one like a few months later on valentines day. Recently someone stole it fom my backpack and I have a few suspicions on wo it may be. Can you please help me find it and help me make the program "FIND ME" because I'm really not good at using computers. Please I beg you I lost two Iphone in 1 year;you can't imagine how I feel. Thanks for taking your time to read this! Bye
March 08 2008 at 11:41 AM Report abuse Permalink rate up rate down ReplyOi, if you guys want to check this out, I need some testers :)
http://apps.facebook.com/iphonelocator/
It's a Facebook App that you add, and a dynamically generated REPO, creates a dynamically generated zip file as well, and installs on your iPhone. Basically a repackaged FindMe, which updates your Facebook of it's current location. It has the same sleep bugs as any other script :( hopefully that'll be resolved soon. Private and Public modes, update intervals and some other stuff. Planning on implementing location tagging too.
Let me know if it works? Drop me an e-mail or a message on Facebook.
-Dan
I had the lojack working mostly although it wouldn't tweet automatically. It would report online if I ran 'tweet' via the terminal. To attempt to fix this I reformatted the launch daemon to match what is above. Now however I am getting a "Error: Could not detect latitude and/or longitude" but it will tweet automatically. Any ideas???
March 03 2008 at 10:38 PM Report abuse Permalink rate up rate down Replyits because the findme default skyhook account is locked out. I think it has been hit too many times. try using this
findme -k -T username:password
if you want a fool proof fix register a skyhook SDK at http://www.skyhookwireless.com/developers/sdk.php
use the following.
NOTE: "skyhookusername" refrences the username you created when registering your SDK, and "skyhookrealm" refrences the realm you created..
findme -u skyhookusername -r skyhookrealm -T username:password
I have also found that there is also a bug that causes the SH script to hang. I saw it occur when I was making a call and the script tried to get tower info from google maps. It causes a BUS error then locks the script in limbo until you "stop" the deamon. I am writing a work around shell script. Ill post it when Im finished testing it.
for continuing info check these discussions out.
http://ericasadun.com/?p=184
http://ericasadun.com/?p=179
Also for keeping your iphone awake check this out!
http://code.google.com/p/iphone-insomnia/
A few of us are working to get something similar incorperated into the next findme version.
Erica released her new version of findme (Muchbetter version) but it doesnt parse a link on twitter? Does attempt to extrapolate an address which is cool.
Also I have noticed that the pingwifi never wakes my phone up.
And I have noticed that I have to reboot my phone every day to get the application to continue to run?
Ahh! the findme app had args I didnt see.
I just changed the tweet file.
/bin/pingwifi; sleep 10
#! /bin/sh
/bin/findme -T username:password
I have been playing with this all day but for some reason after the phone is idle for more than 20 - 30 minutes the script does not automattically run without unloading and relaoding the launchdeamon..
March 03 2008 at 2:07 AM Report abuse Permalink rate up rate down ReplyHey - I installed the app from Shai's installer app, ssh-ed in and put in my name/password. It worked after I rebooted (just like instructed), but only for a couple of hours. Then it stopped....got about 160 twitters, last one 14hrs ago. Whats going on? Any solutions?
February 28 2008 at 12:19 AM Report abuse Permalink rate up rate down Replythe keylogger idea is geniusâ the first thing someone did when they stole my phone was brag they stole my phone to their friends. if I could have received that whole conversation, that would be awesome.
Unfortunately, it would be unlikely to be allowed by Apple, as that would be seen as a trojan... and when did Apple get so pathetic it is unwilling to do things folks here can do in a week in-between blogging?
Oh right, I forgot... stolen iPhones mean a new account cut from the thief who re-activates it, and a new sale for the replacement. Too bad the moment the idiot thief docks it into their iTunes, the latest update would kill it, and so this wouldn't work...
WeeGee by Fuel, has already done this. The problem is, command line utilities do not bring up the edge/wifi pipes. So when the phone is asleep for a minute or so, it disconnects from edge and wifi crippling all command line utilities that use internet. At the moment, the method I use to use internet on command line is to open safari load a page and go to Term-vt100 before the pipe closes.
Max
Hot Apps on TUAW
Deals of the Day
more deals- Refurb Apple MacBook Air Laptops: 12" 64GB SSD for $699 + free shipping
- JVC Motion Sensing Clock Radio with Dual iPod Docks for $55 + free shipping
- Apple iPhone Headset with Mic for $4 + $2 s&h
- miFrame Picture Frame Dock for iPad for $64 + $8 s&h
- Refurb Apple iPod nano 8GB MP3 Player for $99 + free shipping, 16GB for $119
- Hannspree Apple-Shaped 28" 1080p LCD HDTV for $270 + free shipping
Software Updates
more updates- EFI Firmware Update brings Lion Internet Recovery to 2010-model Macs
- OS X Lion 10.7.3 released with Safari 5.1.3, Wi-Fi bug fix
- Aperture updated to 3.2.2, addresses Photo Stream issue
- Apple updates Keynote to address Lion issues
- Google Search app gets new look on iPad
- Apple releases Apple TV Software Update 4.4.3



135 Comments