Hi. Hope this is easy to solve, but till now i still could not solve the problem.
when i create :
ex:
local myMap = native.newMapView( 20, 20, 300, 220 )
myMap.x = display.contentCenterX
myMap.y = display.contentCenterY
a blinking marker always appear in my current position.
I don’t won’t that by default i want the option to show it or not.
I tried with no luck:
myMap:removeAllMarkers()
This only remove markers i made with addMarker?
also regarded with addMarkers:
I tried:
ex:
local options =
{
title = “Displayed Title”,
subtitle = “subtitle text”,
listener = markerListener,
imageFile = “someImage.png”,
}
local result, errorMessage = myMap:addMarker( 37.331692, -122.030456, options )
if ( result ) then
print( “everything went well” )
else
print( errorMessage )
end
result in nexus 7 2013 with lolipop 5.01 is 0 marks on the device. my corona build is 2517.
if i put a timer with some delay before doing the addMarker, it works.
ex:
timer.performWithDelay(2000,
function()
local result, errorMessage = myMap:addMarker( latitute, longitude, options )
if ( result ) then
– native.showAlert( “OK”, “Correu tudo bem!” , { “OK” } )
print( “everything went well” )
else
native.showAlert( “ERROR”, errorMessage , { “OK” } )
print( errorMessage )
end
end, 1)
is this a feature? do i need to do this?
I think native.newMapView misses an handler so other options can be made safely, or i missing something.
I can do it work without the timer in requestLocation handler.
ex:
local function mapLocationHandler( event )
– handle mapLocation event here
if event.isError then
print( "Error: " … event.errorMessage )
else
print( "The specified string is at: " … event.latitude … ", " … event.longitude )
latitute=event.latitude
longitude=event.longitude
myMap:setCenter(latitute,longitude)
local result, errorMessage = myMap:addMarker( latitute, longitude, options )
if ( result ) then
print( “everything went well” )
else
native.showAlert( “ERROR”, errorMessage , { “OK” } )
print( errorMessage )
end
end
end
myMap:requestLocation( “real location here”, mapLocationHandler )
this code works great. mark appear without a problem without the timer. do i need to do this step?? this looks more a workaround than a feature…
best regards.