Track yourself and your (stolen) Iphone

So.. I saw the homepage of Tijs Teulings and got inspired with his ‘my current location’ thingy. As you can see on the map, it uses an Iphone (I guess).

Now..this is the way to create something like that:

  1. Install the Navizon application on your Iphone. Using installer.
  2. Create the needed account for it.
  3. Start Navizon and set ‘Appear Visible’ to ON.
  4. Login to your Navizon account at:
    http://my.navizon.com/Webapps/UserAdmin/index.aspx
  5. Go to: Display the location of users in my group in Browser.
    And press: Publish location to public URL.
  6. Copy the XML URL to your clipboard.

Now the only thing you have to do is grab the coordinates out of this XML-feed and put them in a map. I’ve supplied some Ruby code to do this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Navizon::Tracker wrapper in Ruby by Joost Hietbrink (joost@joopp.com)
# See: http://blog.joopp.com/2008/05/21/track-yourself-and-your-stolen-iphone/
module Navizon
  class Tracker
 
    attr_accessor :url, :user, :resul
 
    # Usage:
    # tracker = Navizon::Tracker.new('1F51235E5F58')
    def initialize(user)
      @user = user
      @url = "http://my.navizon.com/Webapps/UserAdmin/UserService.asmx/GetUserLocation?user=#{user}"
    end
 
    def track!
      xml_data = Net::HTTP.get_response(URI.parse(@url)).body
      @result = XmlSimple.xml_in(xml_data, { 'ForceArray' => false })
    end
 
    require 'xmlsimple'
    # Returns location as array [lat, lng]
    def location
      @result ||= self.track!
      location = @result['UserInfo']['Location']
      [location['Latitude'].to_f, location['Longitude'].to_f]
    end
 
    # Returns Ruby time of result
    def timestamp
      @result ||= self.track!
      Time.parse(@result['UserInfo']['Location']['Timestamp'])
    end
 
  end
end

When on Rails, put this in lib/navizon.rb. And install the xml-simple gem.

Now to put it on your site just use the Google Maps API, or Yahoo or Microsoft or just all of them (mapstraction). Get the location by using the following in your controller action:

1
2
  # Returns a [lat, lng] array
  @location = Navizon::Tracker.new('1D52195EFFFF').location

Of course you should replace the ‘1d52…FFFF’ part with the part in the XML URL you still have on your clipboard (right ;))

Have fun!

3 Responses to “Track yourself and your (stolen) Iphone”


  1. 1 Tijs Teulings May 23rd, 2008 at 9:05 am

    Hi Joost, i do indeed use an iphone and navizon for much the same setup only using PHP. which i just noticed has an error which i am now obliged to fix i guess :)

  2. 2 Susan Fenton Jul 12th, 2008 at 6:53 pm

    Hey this is awesome, but there’s a MUCH EASIER way now - you should check out iRedHanded… It tracks your location too, but uses far less battery life (it knows when you’re moving and when you’re not and only activates when you’re moving), plus it lets you remote-wipe your iPhone including all your sensitive data: personal photos, messages, SMS, application settings, site passwords and logged in sessions, all that stuff! It also makes annoying noises (even if switched to silent mode) in case it’s just behind the couch.

    If it’s genuinely stolen you can annoy the thief with noises “I’m stolen” spoken alerts, and popup messages (even if the phone is switched to silent)… Lastly you can spy on the thief and see what numbers they called, texts they sent and received, Wifi networks and IP addresses they connected from, the number of the new SIM card they inserted- enough info to keep a detective happy and bust them pretty quick! I used it recently when I left my iPhone in the back of a cab and didn’t know which cab company to call :D

  3. 3 joseph Sep 10th, 2008 at 9:36 pm

    i got my phone stolen and ill pay some1 for tracking it down

Leave a Reply




About Joopp's Blog

You've reached Joopp's weblog. Joopp is a young company creating innovative web concepts. Check out what we're doing on our website.