Hax by Jaku

GPS Code Update

by on Sep.22, 2009, under Code, Projects

So it seems I have to write this post again because my server crashed.. leaving everything alone but my sql databases… Oh well, could be a lot worst.

So after my post yesterday about how I update my location on my site I got a reply from @andre_vans that told me about a project called “PlayNice”. The GIThub source is at http://github.com/natfriedman/playnice and the the creator of it has a blog post about it at http://nat.org/blog/2009/08/playnice-google-apple/.

Now I mentioned in my post yesterday that I wanted to be able to use some sort of push notification on the iPhone so that my site could ask for an update and the phone would comply. This would require a custom app on the iPhone to automatically execute something when it has a push notification. Now I’m not even sure if that is possible at this stage as that would almost be like the app is running in the background, which apple does not allow yet. However, Apple has such a service built into the phone that allows anyone with a MobileMe account linked to their iPhone to get the location of the device.

So with that PlayNice will basically log in as you on your MobileMe account and launch the locate phone feature. Now the neat thing about this is that it also updates to your Google Latitude account. This make’s it pretty much perfect for what I want to do. With the source code freely available and easy to understand it was a breeze adding 3 lines of code to update my map backend whenever the PlayNice script is ran. If you wan’t to do the same with most of the code from my post yesterday then follow me past the break. Otherwise, ignore me. :)

Now that you are here we know who the true Jaku fans are. :P

Alright so the code that we used yesterday, we only need the mologogo part. So the “update.html” is pretty much useless but you could still certainly use it. What is important here is that you follow the steps in yesterdays post to get the database and mologogo backend software working. Once you do that you will need to make a change to the “submit_2343.php” file or whatever you renamed it to. All you need to do is uncomment lines 41 and 42. This will allow those variables to work again.

The next step is to download the PlayNice code from http://github.com/natfriedman/playnice and follow the install instructions. After doing that you will want to edit the “playnice.php” file and add the following lines around line 91.

$lat = "$iphoneLocation->latitude";
$lon = "$iphoneLocation->longitude";
system ("/usr/bin/curl LOCATION_OF_UPDATE.PHP?pointType=GPS'&'name=Jaku'&'lat=$lat'&'lon=$lon");

Now you don’t need to make those variables if you use the the full $iphoneLocation->latitude\longitude names in your system call, but it looks cleaner.

After you make that change your GPS updates should start getting populated in your GPS map backup.

Up next for me is the creation of a new backup now that I have the simplest update, it’s time to clean up that backend. :)

:, , ,

Leave a Reply


Picture Hax

    Bowmanville, Feb 10, 2009

Don't search for anything!

Don't tell them what not to do!:

Other Haxs!

Archives

All entries, chronologically...