Hax by Jaku

How I made the locate Jaku feature

by Jaku on Sep.21, 2009, under Code, Haxs

The 2 main parts of this software have changed over the years, however this post will describe each change and will include what I currently use to get my location on the site.

The main part is the use of the Mologogo software. Which I used because I had a old boost mobile cell phone and this was the easiest and fastest way to get my location up on the web. It was also the cheapest at $1 dollar a day. After the iPhone came out I developed my own application to get my location and update the mologogo software that way. This was awesome because I could get rid of the boost mobile phone and I only had to carry a single phone then. However after almost every update to the iPhone software, I had to wait for a new jailbreak and then I had to change my code to work. This became a huge hassle and I had to deal with it after every update.

When the iPhone 2.0 software came out I assumed I wouldn’t have to do that anymore. Except for the fact that in order to actually use any application that you wrote, you needed to pay the developer fee. So instead I decided to get my location another way. On many of the twitter iPhone apps it would allow you to update your location and this would then update the GPS coordinates shown on your twitter.com page. This was an easy way to get the location of myself without the need of writing a new custom app. So I wrote some code that would look on my twitter page and find the location of me and check to see if it had updated since the last time it checked. This solution was great because it would only update as much as I wanted, and wouldn’t drain my battery since my phone would do none of the work. However, a few months after this went live twitter decided to change their design and at first the location info was no longer shown. So I had to come up with a new idea.

Now, so far I’ve had 3 different ways to update my location. The first being the boost mobile phone, that worked great except for the fact thatI would forget to charge the phone and it was an additional $30ish a month for me to tell people where I was at. If anything people should of paid me for that info. The second was developing an app that would work on the iPhone and update my location every now and then. What was great about that was, it did not cost anything additional because it was on my main phone, and I didn’t have to worry about the phone not being charged since I always charge my iPhone. Then the 3rd solution was to use a 3rd party site that happens to get my location from another 3rd party app and just parse the data that way. This failed because I had to rely on 2 3rd party companies and hope they don’t make any drastic changes.

Now out of all 3 of the ways I’ve updated my phone, I enjoyed the 2nd the most. Since it wasn’t hard to do, it was just either a pain to wait for the next jailbreak or to pay for the developer license. So with the new iPhone 3.0 update, they allowed you to do something quite magical. You can now get your GPS coordinates though Safari on the iPhone! This was perfect. So I made a page, that would do the geolocation call that Safari now supports. After some testing I was able to get the calls to update a URL by tricking the javascript code I used to into thinking it was going to call an image. I coded my first version of the software off of the code found at http://smithsrus.com/gps-geolocation-in-safari-on-iphone-os-3-0/ and the 2nd version I coded around the source code found on http://www.thecssninja.com/javascript/geolocation-iphone the 2nd version allowed me to
view exactly where I was on the map and looked awesome so I only needed to make some specfic changes so that it could post the data to my site.

I have included the files I use for the Mologogo portion of the site as well as the 2nd version code that I use to find my iPhone’s location. The main plus side on using the webbrowser to update my location is that it can work on multiple platforms without any changes. As long as the device and webbrowser support the new location feature you could use this on anything.

Now, since all of this has happened. I became an iPhone Developer, or at least I paid to be one. So I’ve been toying around with the idea of developing a new app that will use the push feature. I’m not quite sure if it can be done, but basically when ever someone visited my site it would send a push notification to my phone to get the latest GPS coordinates. Now, incase I get a huge amount of traffic I would limit it so that it would only do so every 10 minutes or so after the first push is sent out since it could get rather annoying.

The thing is, I’m not sure if one is able to get information from the phone like that. Perhaps it should be called “Pull” but if I can somehow tie in push alerts to activate a certain function on my phone then I don’t need to worry about opening another app to update my location ever again.

You can download the files in one nice package at http://haxbyjaku.com/gps_code.tar.gz

We are past the story time and so now I will describe how you can download and setup the software. There’s gonna be a few things that might be a bit complicated but it’s fairly easy to do if you’re able to read code.

Once you get the software downloaded you will need to modify a few things. In the molo_config.php file, you will want to update the nickname that it updates the location as, as well as the HTTP_HOST and google maps key labeled as GMAPS_KEY. And of course you’ll want to put in your own database settings. Now the cool thing about the mologogo code is that if the correct tables are not in the database it will create them for you, as long as you give the mysql user enough access to do so.

The 2nd file you’ll want to update is the update.html file. You will want to update USER_NAME and the SITE_URL_REFRESHES_EVERY_30_SECONDS parts of this file. Now I also suggest re-naming this file and the submit.php file something randomish but still easy for you to remember. The reason is that if anyone can figure out what the file names are they could post their own GPS data as yours. So while it’s not the worst thing in the world, it could confuse you if you start to see other peoples locations on your map.

If you have any questions or comments please let me know and I’ll do what I can to help.

:, , , , ,

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...