Add marker on mapview (android)

Add marker on mapview is not vissible on android??

This is my code

_w, _h = display.contentWidth, display.contentHeight

display.setStatusBar( display.HiddenStatusBar )

local widget = require(“widget”);

local myMap = native.newMapView( 20, 20, _w, _h )

if myMap then

    myMap.mapType = “normal”

    myMap.x = display.contentWidth / 2

    myMap.y = 120

    myMap:setCenter( 38.762182, 20.718485 )

    

        local hotelmarker = {

    title = “Ionian Blue”, 

    subtitle = “Νικιάνα, 31100 Λευκάδα”,  

    imageFile = “hotel.png”,

    }

   myMap:addMarker( 38.762182, 20.718485, hotelmarker )

end

I notice that during my testing on several different Android devices on different “google map” versions (on the bigger devices/tablet, it is currently at v7.4.0), the markers may not appear. You need to put in a delay or some sort of redrawing the markers again, if it does not appear. But out of 5 android devices that I tested on, only 1 of them exihibit this problem.

anyway, for your code, try removing the ‘imageFile’ and keep the text to ASCII to see whether it works.

I notice that during my testing on several different Android devices on different “google map” versions (on the bigger devices/tablet, it is currently at v7.4.0), the markers may not appear. You need to put in a delay or some sort of redrawing the markers again, if it does not appear. But out of 5 android devices that I tested on, only 1 of them exihibit this problem.

anyway, for your code, try removing the ‘imageFile’ and keep the text to ASCII to see whether it works.

Is it possible to specify a custom image for a marker?

Hi @springmorning,

Please see this document, it should help:

http://docs.coronalabs.com/api/type/Map/addMarker.html

Best regards,

Brent

Is it possible to specify a custom image for a marker?

Hi @springmorning,

Please see this document, it should help:

http://docs.coronalabs.com/api/type/Map/addMarker.html

Best regards,

Brent

Just find one solution

Convert location to number

 myMap:addMarker( tonumber(38.762182), tonumber(20.718485), hotelmarker )

Just find one solution

Convert location to number

 myMap:addMarker( tonumber(38.762182), tonumber(20.718485), hotelmarker )

You can’t add markers directly after creating the map object on Android as you can on Iphone, it gets interrupted. Some devices will just show no markers at all, or just a few of them. On Android, you must add them in a callback function called 6 seconds later.

Yes I noticed that too. Though in my case it works fine with a delay of just 300ms.

That did not work on this device.

You can’t add markers directly after creating the map object on Android as you can on Iphone, it gets interrupted. Some devices will just show no markers at all, or just a few of them. On Android, you must add them in a callback function called 6 seconds later.

Yes I noticed that too. Though in my case it works fine with a delay of just 300ms.

That did not work on this device.

i have to draw line on mapView ?

myMap:addMarker( event.latitude, event.longitude)

this is only indicate the point but i wants to draw line path on mapView.

With Corona SDK you cannot draw on top of a mapView other than apply markers.   If you need this functionality, you probably could make this work with Corona Enterprise.

Rob

i have to draw line on mapView ?

myMap:addMarker( event.latitude, event.longitude)

this is only indicate the point but i wants to draw line path on mapView.

With Corona SDK you cannot draw on top of a mapView other than apply markers.   If you need this functionality, you probably could make this work with Corona Enterprise.

Rob