Rahul Chidgopkar
Posts: 0
Joined: Tue May 14, 2013 7:11 am

Google Maps behaving oddly when app loaded on phone

Hi, I have created a small app which is supposed to show a marker at your current location and open an InfoWindow on click. I have put this code on my Page Show event:

/******CODE STARTS ******/
//alert('in pageshow');
var lat = parseFloat(localStorage.getItem('latitude'));
var long = parseFloat(localStorage.getItem('longitude'));
//alert(lat + ',' + long);
var map = new google.maps.Map($('div[dsid="googlemap"]').get(0), {
zoom: 10,
center: new google.maps.LatLng(lat,long),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
//alert('map');
var marker = new google.maps.Marker({
position: new google.maps.LatLng(lat,long),
map: map
});
//alert('marker');
marker.setAnimation(google.maps.Animation.BOUNCE);
google.maps.event.addListener(marker, 'click', function(){
queryPhotoService.execute({});
map.setZoom(12);
if (marker.getAnimation() != null) {
marker.setAnimation(null);
}
else {
marker.setAnimation(google.maps.Animation.BOUNCE);
}

Code: Select all

var [img]" + localStorage.getItem([/img] width="100" Clicked at: 

" + localStorage.getItem('queriedTimestamp') + "";

Code: Select all

 //Create InfoWindow 
 var infowindow = new google.maps.InfoWindow({ 
  content:imgsrc 
 }); 

infowindow.open(map,this);
});

/***CODE ENDS***/

This code works perfectly on the computer. The marker gets set, query is fired and InfoWindow opens. But when I try to test it on my mobile using app tester, the google map loads but it doesn't set center correctly or create a marker. Same problem when I build an apk and loaded it directly on the phone. I have tried all kinds of things but it keeps working on the browser but not on the phone. My app name is Monitorly Lite. Pls check in your mobiles and help me figure out the problem. I need to show my POC on Monday, so any help in the weekend is appreciated.

Thanks,
Rahul

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Google Maps behaving oddly when app loaded on phone

Hi Rahul!

What version of Android do you have?
Share please your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Google Maps behaving oddly when app loaded on phone

Hello! In your app coordinates will be set only after you make new photo. Other way geolocation service won't work.

Return to “Issues”