is already a latLng object so you can just say:results[0].geometry.location
center: results[0].geometry.location
Find the working fiddle here : http://jsfiddle.net/87z9K/
As I see in the screenshot you've added, looks like your map fragment loaded already (check the Google logo in the bottom-left corner). Due to slower internet the map is taking long time to load perhaps.
The changes need to be made to every one of the syntax errors. The full js is below. here is a fiddle, it doesn't show the markers because I can't use ajax cross domain to get the list but you can see the map load. http://jsfiddle.net/zvmdp/
edit changed your code to this and it runs
var customIcons = {
restaurant: {
icon: 'http://labs.google.com/ridefinder/images/mm_20_blue.png',
shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'
},
bar: {
icon: 'http://labs.google.com/ridefinder/images/mm_20_red.png',
shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'
}
};
function load() {
var map = new google.maps.Map(document.getElementById("map"), {
center: new google.maps.LatLng(34.026485, -118.283794),
zoom: 14,
mapTypeId: 'roadmap'
});
var infoWindow = new google.maps.InfoWindow;
// Change this depending on the name of your PHP file
downloadUrl("http://firstchoicehousing.com/_api/google/maps/phpsqlajax_genxml2.php", function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var address = markers[i].getAttribute("address");
var type = markers[i].getAttribute("type");
var point = new google.maps.LatLng(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var html = "<b>" + name + "</b> <br/>" + address;
var icon = customIcons[type] || {};
var marker = new google.maps.Marker({
map: map,
position: point,
icon: icon.icon,
shadow: icon.shadow
});
bindInfoWindow(marker, map, infoWindow, html);
}
});
}
function bindInfoWindow(marker, map, infoWindow, html) {
google.maps.event.addListener(marker, 'click', function() {
infoWindow.setContent(html);
infoWindow.open(map, marker);
});
}
function downloadUrl(url, callback) {
var request = window.ActiveXObject ?
new ActiveXObject('Microsoft.XMLHTTP') :
new XMLHttpRequest;
request.onreadystatechange = function() {
if (request.readyState == 4) {
request.onreadystatechange = doNothing;
callback(request, request.status);
}
};
request.open('GET', url, true);
request.send(null);
}
function doNothing() {}
I had this problem yesterday in designing a customer in the company. it was two crazy days to work it out with the customer behind me. What I did was:
Delete the current key (API Key) from the Google Dashboard APIs. Delete the firebase web key from the Google dashboard APIs. Create a new Key API for android, register the SHA-1 and package name. and add in project android studio;
In the FIrebase project delete the SHA-1 code to add again. Download google-services.json, and add in the project;
Generate the app in release mode, publish in the store, and download on some device, when running the app should show the Map normally;
If not, it will show you the error in LogCat, saying that you must register the following SHA-1 key: XXXXXXXXXXXXXXXXX and the package name: com.your.package-name;
Just register that key in Google APIs, and it will work in a few seconds, without even having to update the app in the store.
NOTE: Another thing, consider upgrading the dependencies of Google Maps, and Google Services.
Hope this helps.