The GPS Tracker project is a cool way to track a GPS-enabled cell phone using Google Maps. For this project, I used a Motorola i355 cell phone on the Sprint/Nextel network.
To make this work, you'll need a data plan so you can update your website straight from your cellphone. Don't forget to check the ReadMe.txt file included in the download for installation instructions. I hope you have fun with this project! If you have any questions, feel free to ask in the forum.
There are two versions of this project. The first one is made with .NET and Microsoft SQL Server, while the second uses PHP and MySQL. If you have any suggestions or ideas, I'm all ears! Both projects run Java (J2ME) on the phone.
The code isn’t too tricky, but it does cover several layers and languages that might be new for some folks. Check out Figure 1; it shows how data flows from the phone to Google Maps.
Let’s start with what’s happening on the phone. This app is written in Java using Java 2 Micro Edition (J2ME). Java resembles C# quite a bit. If you're coming from C#, you might find 'vector' a bit confusing—it's similar to an ArrayList in C#. The app has two classes: LBSMidlet7 and QWorker.
In the constructor, we do two things: we create a QWorker object and pass 'this' along with our website address where we'll upload data. The getAppProperty method pulls info from the JAD file—open that in your favorite text editor to see where we're sending GPS data!
When we start our worker thread, it enters an endless loop calling queue.wait(). This is like lining up at a bank—you enter at the back and leave when it's your turn! And when we call wait(), our QWorker object goes to sleep until something wakes it up again.
The startApp() method comes next in our midlet lifecycle—it can be called multiple times if you close and reopen your flip phone! This allows us to grab GPS data while multitasking, like making calls!
The LocationProvider helps us get GPS info by setting criteria like accuracy and response time. We set it to fetch updates every 60 seconds; when new data arrives, locationUpdated() kicks in!
The QWorker class adds our queryString to its queue before calling queue.notify(), waking up our sleeping thread so it can send GPS data back home—our web server! If sending fails due to no signal, we simply keep that string safe until we’re back online.
This explanation covers much of what's going on with our code—it might seem complex now but knowing how everything works will help if you want to tweak things later! For more about Location-Based Services API capabilities, check out this article here!
Go to the Softpas website, press the 'Downloads' button, and pick the app you want to download and install—easy and fast!
SoftPas is your platform for the latest software and technology news, reviews, and guides. Stay up to date with cutting-edge trends in tech and software development.
Subscribe to newsletter
© Copyright 2024, SoftPas, All Rights Reserved.