Reputation: 105
I have an application for android for my business that automatically tracks the users GPS location. This location is then stored in a database and shown on a Google Maps using API V3 with HTML and PHP.
We are using this for a long time now and it works perfectly, the only thing i can't get to work is the updating the markers live without refreshing the page. I've been looking for a long time now and hope that someone here can help me.
Upvotes: 1
Views: 3147
Reputation: 401
It's been a while so I don't know if you are still looking for an answer.
Create a function that deletes all current markers and then adds them. You need to loop through all map items by interrogating the map.
Create a php file that returns the current marker locations. This will be basically Javascript that you can query which has an array of locations.
Finally you need a timeout loop in Javascript, something like
function timeout() {
setTimeout(function () {
// Read new markers in via AJAX
// Delete markers
// Add Markers
timeout();
}, 1000);
}
Hope this helps.
Upvotes: 1