My google map on iphone seems to be in a weird reload cycle. It flickers badly, and sometimes it doesn't even display on the page. As it stands right now, it isn't even usable. The problem exists on android too, but it is MUCH better on android than it is on the iphone. On android it flickers briefly, but it doesn't crash the app and is still usable. On my dev machine, everything works fine.
The project is already shared with support. I'd be very grateful if you guys can help.
My google maps code in its entirety: (I don't believe this to be the problem).
Code: Select all
var mapElement;
var mapOptions;
var map;
var presentLocation;
var bodyicon = Appery.getImagePath('crimescene.png');
var policeicon = Appery.getImagePath('police.png');
var personicon = Appery.getImagePath('male-2.png');
function initialize()
{
console.log('building map.')
presentLocation = getPresentLocation();
var mapOptions = {
zoom: 12,
center: presentLocation,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
var marker = new google.maps.Marker( { position: presentLocation, map: map, title:'You are Here.', icon:personicon });
//var marker = new google.maps.Marker( { position: presentLocation, map: map, title:'Your body is Here.', icon:bodyicon });
var request = {
location: presentLocation,
radius: 20000,
types: ['police']
};
var service = new google.maps.places.PlacesService(map);
service.nearbySearch(request, function callback(results, status)
{
if (status == google.maps.places.PlacesServiceStatus.OK)
{
//console.log('Police Stations:', results)
results.forEach( function(element, i)
{
//console.log('Creating marker for [' + i + ']', element )
createMarker(element);
});
}
});
console.log('done.');
}
function createMarker(place)
{
//console.log(place);
if(typeof(place) == 'undefined') return;
var placeLoc = place.geometry.location;
var info = place.name;
var marker = new google.maps.Marker( { map: map, position: place.geometry.location, icon:policeicon, title:info } );
google.maps.event.addListener
(
marker,
'click',
function()
{ infowindow.setContent(place.name);
infowindow.open(map, this);
}
);
}
function getPresentLocation()
{
var lat = localStorage['localLat'];
var lng = localStorage['localLong'];
return new google.maps.LatLng(lat,lng);
}