GPS Tracker icon

GPS Tracker For Linux

1.0/5 1
GPL    

GPS Tracker project allows someone to track a GPS enabled cell phone using Google maps.. #Track GPS  #GPS cell phone  #Google maps  #GPS  #Tracker  #Phone  

Description

Free Download

GPS Tracker project allows someone 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.

You need to have a data plan so that you can make updates to your website from the cellphone. Please read the ReadMe.txt file in the download for installation instructions. I hope you enjoy the project. If you have any questions, feel free ask them in the forum.

There are two projects available. The first project is built with .NET and Microsoft SQL Server. The second project is built with PHP and MySQL. If you have any suggestions, please feel free to let me know. Both projects use java (J2ME) on the phone.

None of the code for this project is very difficult, but it does span a number of tiers and languages which may be unfamiliar to some. Figure 1 shows the data flow from phone to Google map.

Let's start with the code on the phone. This app is written in java using Java 2 Micro Edition (J2ME). Java is very similar to C#. As you look through the code, the only thing that might confuse a C# coder is the vector. A java vector is pretty much a C# ArrayList, a dynamic array. There are 2 classes in the app, LBSMidlet7 and Qworker. A midlet is an app that runs on cell phones. Take a look at the class definition. It extends the MIDlet class and implements a LocationListener interface. That means that we need to put all the method definitions of that interface into our class. We'll get to that in a bit, right now let's look at the constructor.

We do 2 things in the constructor. We create a QWorker object and pass it "this" and the website that we will be uploading to. The getAppProperty method gets attributes out of the JAD file. Open the JAD file in your favorite text editor and there you'll see the webpage that you'll be sending GPS data to. Notice how we're passing "this" to the GWorker object? That's the LBSMidlet7 object. Take a quick look at the QWorker class, it extends the Thread class. That's why we call worker.start() in the LBSMidlet7 constructor. We want to start our worker thread.

When you start a thread, what you are doing is creating an object and then running that object's run() method. Take a look at the run method. It has an endless loop and in the loop the first thing it does is call queue.wait(). Look at the definition of the queue. The queue is an abstract data type (ADT), it just like a queue at a bank, enter the queue at the back of the line and leave the queue when you get to the front of the line. Look at the definition of the queue, it's our vector (dynamic array). When you call wait() on an object within a class that extends the Thread class, it puts that object to sleep. Think about that a little. When we hit that line, our QWorker object is now waiting... What's it waiting for? We'll get to that in a minute. Before we do that, take a look at the synchronized keyword. Notice that it's wrapping the queue. What that does is it puts a lock on the queue and tells all other processes not to touch the queue until that little block of code is done with it.

Ok, so now we've started a worker thread and put it to sleep. Let's now go back to the LBSMidlet7 class and take a look at the startApp() method. In the lifecycle of a midlet, the constructor is called once and then the startApp() method is called next. In fact it can be called several times, like for instance when you close a flip phone and then open it again. What happens is that the app is suspended and when you flip the phone open again, startApp() is called again. In startApp(), we get our display and then we create a LocationProvider if one hasn't already been created and we create another thread... Why are we creating all these threads? Good question. When a midlet (app) is suspended, the backgroud threads that are created keep running. That allows us to get our GPS data and send it to our webserver while we do other important stuff, like make phone calls.

The LocationProvider is what gets our GPS data. First we create a criteria, we're using the default, but you can set stuff like accuracy, response time etc. Next we create our Location Listener. It's pretty much just what it sounds like. Here you can set the interval for how often you want to get GPS data. It's currently set to 60 which is in seconds. When data comes in, the locationUpdated() method is called. This is another one of the required methods in the LocationListener interface. Here we create yet another thread and call getLocation(). The getLocation() method gets the GPS coordinates, creates a queryString which we will send to the web server a little later and then calls worker.addToQueue in the QWorker class.

Let's go back over to the QWorker class and see what happens in that method. It add the queryString to the queue and then calls queue.notify(). Guess what queue.notify() does? It wakes up our sleeping QWorker thread and tells it to get to work! Notice that our calls to the queue are once again wrapped in a synchronized block. Please practice safe threading... When notify() is called on a thread, what it does is go back to the run() method and execute the next line of code right after where we told the queue to wait(). So now we are just about ready to send the GPS data to the web server. We have a couple of interesting lines of code there. First we call peekInQueue() which gets the queryString out of the queue but leaves it there for now. Then it sends the queryString to the getUrl method which attempts to send the queryString to our web server. If it's successful, we can remove the queryString from the queue. If not, we leave the queryString in the queue and try to send it to the webserver again later.

Why in the world do we have this complicated queue here? I'm glad you asked. There may be times when you are receiving GPS data but are not actually in an area that has a cell phone connection. If we don't have a cell phone connection, we can't send our GPS data to our web server. So we stick our queryString in our queue and wait until we get back into an area with cell phone connectability. Can you hear me now?

Well, we've spent a pretty fair bit of time explaining the phone code. It's a little complicated but it's important to know what's going on if you want to take the code and make modifications to it to suit your needs. Here's a good article on the Sun website to let you know about more capabilities of the Location Based Services API. Right about now, our queryString should be arriving at our website, let's catch up to it and see what happens.

What's New in This Release:

� Added comments to code

GPS Tracker 0.3.1

add to watchlist add to download basket send us an update REPORT
  runs on:
Linux
  1 screenshot:
GPS Tracker - screenshot #1
  main category:
Internet
  developer:
  visit homepage

4k Video Downloader 1.5.2.0077 Plus / 4.30.0.5655

Export your favorite YouTube videos and playlists with this intuitive, lightweight program, built to facilitate downloading clips from the popular website
4k Video Downloader

Zoom Client 6.0.0.37205

The official desktop client for Zoom, the popular video conferencing and collaboration tool used by millions of people worldwide
Zoom Client

Microsoft Teams 24060.2623.2790.8046 Home / 1.7.00.7956 Work

Effortlessly chat, collaborate on projects, and transfer files within a business-like environment by employing this Microsoft-vetted application
Microsoft Teams

IrfanView 4.67

With support for a long list of plugins, this minimalistic utility helps you view images, as well as edit and convert them using a built-in batch mode
IrfanView

7-Zip 23.01 / 24.04 Beta

An intuitive application with a very good compression ratio that can help you not only create and extract archives, but also test them for errors
7-Zip

Windows Sandbox Launcher 1.0.0

Set up the Windows Sandbox parameters to your specific requirements, with this dedicated launcher that features advanced parametrization
Windows Sandbox Launcher

calibre 7.8.0

Effortlessly keep your e-book library thoroughly organized with the help of the numerous features offered by this efficient and capable manager
calibre

Bitdefender Antivirus Free 27.0.35.146

Feather-light and free antivirus solution from renowned developer that keeps the PC protected at all times from malware without requiring user configuration
Bitdefender Antivirus Free

paint.net 5.0.13 (5.13.8830.42291)

Packed with an array of options and an intuitive interface, this application enables you to create professional-looking photographs
paint.net

ShareX 16.0.1

Capture your screen, create GIFs, and record videos through this versatile solution that includes various other amenities: an OCR scanner, image uploader, URL shortener, and much more
ShareX

38% discount
Bitdefender Antivirus Free
  • Bitdefender Antivirus Free
  • paint.net
  • ShareX
  • 4k Video Downloader
  • Zoom Client
  • Microsoft Teams
  • IrfanView
  • 7-Zip
  • Windows Sandbox Launcher
  • calibre
essentials


User Comments
This enables Disqus, Inc. to process some of your data. Disqus privacy policy