Joystiq has you covered with all things Metal Gear Solid 4!

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!

Related Headlines

Reader Comments (Page 1 of 7)

TUAW Features


Mac 101 ask-tuaw
Mac News
WWDC (250)
.Mac (57)
Accessories (635)
Airport (74)
Analysis / Opinion (1329)
Apple (1638)
Apple Corporate (556)
Apple Financial (187)
Apple History (45)
Apple Professional (54)
Apple TV (160)
Audio (446)
Bad Apple (118)
Beta Beat (149)
Blogging (84)
Bluetooth (16)
Bugs/Recalls (56)
Cult of Mac (869)
Deals (214)
Desktops (115)
Developer (252)
Education (98)
eMac (10)
Enterprise (138)
Features (397)
Freeware (381)
Gaming (361)
Graphic Design (31)
Hardware (1281)
Holidays (37)
Humor (576)
iBook (65)
iLife (234)
iMac (184)
Internet (325)
Internet Tools (1309)
iTS (967)
iTunes (796)
iWork (21)
Leopard (367)
Mac mini (112)
Mac Pro (53)
MacBook (202)
MacBook Air (79)
Macbook Pro (220)
MobileMe (16)
Multimedia (439)
Odds and ends (1437)
Open Source (277)
OS (910)
Peripherals (208)
Podcasting (182)
Podcasts (89)
Portables (197)
PowerBook (135)
PowerMac G5 (50)
Retail (579)
Retro Mac (48)
Rig of the Week (42)
Rumors (629)
Software (4304)
Software Update (406)
Steve Jobs (252)
Stocking Stuffers (50)
Surveys and Polls (97)
Switchers (112)
The Woz (34)
TUAW Business (236)
Universal Binary (281)
UNIX / BSD (61)
Video (902)
Weekend Review (82)
WIN Business (47)
Wireless (83)
Xserve (39)
iPhone/iPod News
iPhone (1490)
iPod Family (2024)
App Store (17)
SDK (14)
Mac Events
One More Thing (27)
Liveblog (1)
Other Events (226)
Macworld (489)
Mac Learning
AppleScript (2)
Ask TUAW (101)
Blogs (85)
Books (26)
Books and Blogs (62)
Cool tools (443)
Hacks (459)
How-tos (482)
Interviews (43)
Mods (185)
Productivity (586)
Reviews (107)
Security (153)
Terminal Tips (58)
Tips and tricks (563)
Troubleshooting (166)
TUAW Features
iPhone 101 (26)
TUAW Labs (3)
Blast From the Past (17)
TUAW Tips (141)
Flickr Find (34)
Found Footage (81)
Mac 101 (88)
TUAW Interview (31)
Widget Watch (198)
The Daily Best (1)
TUAW Faceoff (4)

RESOURCES

RSS NEWSFEEDS

Powered by Blogsmith

Sponsored Links

The Unofficial Apple Weblog (TUAW) bloggers (30 days)

#BloggerPostsCmts
1Cory Bohon871
2Robert Palmer5743
3Steven Sande5523
4Scott McNulty360
5Mat Lu358
6Dave Caolo330
7Erica Sadun282
8Brett Terpstra210
9Mike Schramm182
10Michael Rose1334
11Christina Warren938
12Joshua Ellis44
13Lisa Hoover26
14Jason Clarke11
15Chris Ullrich12

Featured Galleries

Macworld 2008 Keynote
Macworld 2008 Build-up
Apple Vanity Plates
DiscPainter
Macworld Expo 2007 show floor
The Macworld Faithful in Line
iPhone First Look
AT&T 3G Coverage Map
MobileMe Guided Tour UI Changes

 

    Most Commented On (7 days)

    Recent Comments

    More Apple Analysis

    More from AOL Money and Finance

    Weblogs, Inc. Network

    Other Weblogs Inc. Network blogs you might be interested in: