I’m working on a project for school and I need to track a user in real time using Google Maps. So far, I have an Android app that sends coordinates to a website, and that website has a Google map that places a marker based on the GPS coordinates.
I need to be able to track the user in real time by constantly updating the map somehow. I also need to draw a line to record the user’s movements. My site so far only updates when the page is refreshed. I have heard about sockets, but I’m not really sure where to begin with something like that. My site is mostly PHP but the map portion is JavaScript. If anyone has links to good tutorials or some advice on using sockets I would really appreciate it!
Instead of using sockets, you should use JavaScript to periodically query your web server for changes in the phone’s physical location.
You will most likely want to use the Google Maps JavaScript API to draw markers and lines on the map.
The easiest way to do this is to use a timer which asks the server (using jQuery) for updated location every x seconds and if the phone’s coordinates have changed by a set amount, draws a new marker and line on the map.
Read some of the jQuery tutorials and PHP JSON manuals for further help.