Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local image for marker icon on Cordova/Phonegap Google Maps Plugin

Is it possible to use an image locally store on the device as the marker icon? I can use a URL and it works, but when I try to use a local image it won't load. How should I reference the image? This is a multiplatform application so I can't use device specific paths like Android file:///android:asset/

map.addMarker({
    'position': new plugin.google.maps.LatLng(13.7579507,100.5643353),
    'title': 'Fortune Town',
    'icon': '../templates/icon2.png'
}, function(marker) {
    marker.showInfoWindow();
});

I am using Ionic Framework (which uses AngularJS) and Apache Cordova with the Google Maps plugin from https://github.com/wf9a5m75/phonegap-googlemaps-plugin/

like image 671
momo Avatar asked Oct 27 '14 03:10

momo


1 Answers

It doesn't make too much sense but this is what worked:

'icon': 'www/templates/icon2.png'
like image 92
momo Avatar answered Nov 15 '22 07:11

momo