Multiple users current location on map

Hello,

Here is what i’m trying to achieve:

Multiple persons use the app and are connected to eachother through facebook.
Now each person is on a different position and is seeing the other persons on their position located on the map.

I already made it that you can see yourself on the map with a marker. Now i want it to connect eachother to a database/session or something similar so that each person their locations is updated and shown to the other persons.

This is the sample code that i have now:

– Create a native map view
local myMap = native.newMapView( 20, 20, 280, 360 )
myMap.x = display.contentCenterX

local attempts = 0

local locationText = display.newText( "Locatie: ", 0, 400, native.systemFont, 16 )
locationText.anchorY = 0
locationText.x = display.contentCenterX

local function locationHandler( event )

    local currentLocation = myMap:getUserLocation()

    if ( currentLocation.errorCode or ( currentLocation.latitude == 0 and currentLocation.longitude == 0 ) ) then
        locationText.text = currentLocation.errorMessage

        attempts = attempts + 1

        if ( attempts > 50 ) then
            native.showAlert( “Geen GPS signaal”, “Het lukt niet om te synchroniseren met GPS.”, { “Oke” } )
        else
            timer.performWithDelay( 2000, locationHandler )
        end
    else
        locationText.text = "Huidige locatie: " … currentLocation.latitude … “,” … currentLocation.longitude
        myMap:setCenter( currentLocation.latitude, currentLocation.longitude )
        myMap:addMarker( currentLocation.latitude, currentLocation.longitude )
    end
end

locationHandler()

Thanks for any help or tips!

OK, so this is a really old thread, but I Thought I’d answer in case it came up in a google search (like it did for me).

My 2c worth… 

I’d use a database on your server, along with php and in the app, you can write your location based upon a timer. Eg: once per minute.

Then you can query the database and pull in all users and add them as markers.  

Since you can’t “update” a marker, you would have to remove and re-add them on your update interval.

OK, so this is a really old thread, but I Thought I’d answer in case it came up in a google search (like it did for me).

My 2c worth… 

I’d use a database on your server, along with php and in the app, you can write your location based upon a timer. Eg: once per minute.

Then you can query the database and pull in all users and add them as markers.  

Since you can’t “update” a marker, you would have to remove and re-add them on your update interval.