Hi
I followed the tutorial
http://devcenter.appery.io/tutorials/...
and while in test all work fine, in Samsung Galaxy S4, when I click "Place marker" it does not update the map. When I click on show directions it works.
Can you help?
Thanks.
Hi
I followed the tutorial
http://devcenter.appery.io/tutorials/...
and while in test all work fine, in Samsung Galaxy S4, when I click "Place marker" it does not update the map. When I click on show directions it works.
Can you help?
Thanks.
Hello Panagiotis,
Could you please provide us with public link to your project and steps to reproduce the issue?
The issue does not happen at the test console.
Only when you install it on my Samsung Galaxy S4 Android 4.4.2
The strange thing is that the direction from to works fine and markers are displayed.
The script that I run when clicking on a button is
code
var locations = [];
var values = $('[name="ResultsText5"]').map(function(index,element){
if ($(element).text().trim().length > 0) {
return $(element).text();
}
}).get().join('@');
locations = values.split("@");
for (var i=0;i<locations.length;i++)
{
Srv_convert_address.execute({
'data' : {
'address' : locations,
'sensor' : false
}
});
}
/code
Are all OK?
Should I do any kind of map refresh?
Thanks!
Hi Panagiotis,
I see in this code some if statement with "return".
So this code could stop without any notification.
Please add before code:
pre
Srv_convert_address.execute(
/pre
Following code:
pre
alert("run convert addres");
Srv_convert_address.execute(
/pre
Also please use WEINRE debugger to see errors in the app in device:
See details: http://devcenter.appery.io/documentat...
Regards.
Hi Yurii
I put some alerts as you said
code
for (var i=0;i<locations.length;i++)
{
alert("run convert addres"); <---------------
alert(locations);<---------------
Srv_convert_address.execute({
'data' : {
'address' : locations,
'sensor' : false
}
});
}
/code
Even on mobile these alerts appear correctly.
So whatever happens,happens inside the Srv_convert_address.execute.
My locations may be "Leoforos Mesogeion 201 Athens Greece" and not just "Paris" like the example.
May this long address be an issue? (in test console works ...)
Thanks
On Srv_convert_address service this code is executed on success
code
var markerLatLng = new google.maps.LatLng(localStorage.getItem('markerLat'), localStorage.getItem('markerLng'));
var marker = new google.maps.Marker({
position: markerLatLng,
map: map,
title: data.results[0].address_components[0].long_name,
animation: google.maps.Animation.DROP
});
bounds.extend(markerLatLng);
map.fitBounds(bounds);
/code
I also created a more simple test case.
One input field, one button.
on button click
code
var locations1 = [];
locations1 = Apperyio('marker_location').val().split(",");
alert (locations1);
for (var i=0;i<locations1.length;i++)
{
Srv_convert_address.execute({
'data' : {
'address' : locations1,
'sensor' : false
}
});
}
/code
I put in input "Paris", alert fires fine but map is not updated.
Solved
I changed the target SDK version to 4.1.x from 4.2.x.
I have Galaxy S4 with 4.4.2
Why it did not work for target 4.2.x?
Will 4.4.x be supported, as I do not see it in the list of target SDK?
Thanks.
Can I have a sample code so I can put markers in google_map, with title, description and small photo, but just using Lat and Lng values?
How can I clear all markers before showing on map, the new set of markers?
Thanks!
Hi Panagiotis,
Glad you solved it..
1 That's not good way to show it all. More preferable is to use infowindow on marker click with information you need.
Here is an example how to use it:
pre
Code: Select all
//Were "multiGoogleMap" is map component name.
var map = Appery("multiGoogleMap").options.mapElement.gmap('get', 'map'); //Create infowindow.
var infowindow = new google.maps.InfoWindow({
content: 'test content',
maxWidth: 320
});
Code: Select all
var CreateMarker = function(data){
var marker = new google.maps.Marker({
position: new google.maps.LatLng(data.lat, data.long),
map: map,
draggable: true,
title: data.location
});
//Add event handler and open infoWindow
google.maps.event.addListener(marker, 'click', function() {
//Set content for infowindow.
infowindow.setContent('Content of + ' + data.location + '');
//Open infowindow.
infowindow.open(map, marker);
});
};
for (var i = 0; i < locationHelper.aLocations.length; i++)
//In this function you should to pass latitude, longitude and text to display in infowindow.
CreateMarker({lat: locationHelper.aLocations[i][0], long: locationHelper.aLocations[i][1], location: locationHelper.aLocations[i][2]}); /pre
2 Unfortunatly there is no way to clear all overlays without handle them.
But when you have this items (which you want to remove from map) you can remove them with ".setMap(null);" method.
See details details about implementation:
http://stackoverflow.com/questions/15...
So with this implementation when you add marker you need invoke:
pre
markersArray.push(marker);
/pre
And when you need remove all markers you can run following JS:
pre
clearOverlays();
/pre
Regards.