Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 63
Registered: ‎09-10-2009
My Device: Z10, Bold 9700
My Carrier: O2 Germany

Google Maps error on OS 10.2

While testing an app on OS 10.2 I ran into a strange error with Google Maps.

 

I'm using the Google Maps JavaScript API V3 for displaying locations on various detail pages in this app. However on OS 10.2 (build 1157) whenever a detail page with a Google Map is opened the app freezes and turns completely black after a few seconds.

 

After some testing I found out that this error doesn't occur if I create a Google Map when the app's first page is loaded. The map doesn't need to be displayed on that page, it must just be created and it's fitBounds() function needs to be called. Then, all Google Maps on subsequent pages work without problems:

 

function fixGoogleMapsInitBug() {
	if (navigator.userAgent.toLowerCase().indexOf('version/10.2') >= 0) {
		var hackmap = new google.maps.Map(document.createElement('div'), { });
		hackmap.fitBounds(new google.maps.LatLngBounds());
	}
}

 

Does anyone have an idea how to explain this strange behavior? I didn't have any problems with the Google Maps API on 10.0 or 10.1.

----

My Twitter: @hendrik_dev
BlackBerry Development Advisor
Posts: 248
Registered: ‎07-14-2008
My Device: Not Specified

Re: Google Maps error on OS 10.2

Hi Can you try the sample below and see if it works there?

 

https://github.com/blackberry/Cascades-Samples/tree/master/webmapview

 

Shadid

BlackBerry Development Advisor
Posts: 248
Registered: ‎07-14-2008
My Device: Not Specified

Re: Google Maps error on OS 10.2

Actually, I just realized that you are on webworks. In that case, can you confirm if this works or not?
https://github.com/blackberry/BB10-WebWorks-Samples/tree/master/Maps

if it doesnt, we will need you to open an issue with us here:
https://www.blackberry.com/jira/
Developer
Posts: 165
Registered: ‎10-04-2010
My Device: P'9982 & Z10
My Carrier: alfa Lebanon

Re: Google Maps error on OS 10.2

I'm having the same issue. My app was actually working, but I'm moving it to webworks 2.0 now and when I run the app I'm seeing the above secribed situation where the app goes all black & unresponsive whenever the map object is created using this:

map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);

 I've tried the example here (https://github.com/blackberry/BB10-WebWorks-Samples/tree/WebWorks-2.0/Maps) & it's working but I'm not sure what the difference is. It's the same code.

 

Also with the Web Inspector I've noticed that the html page for the app simply dispeards when this happens so I can't exactly debug it (see attached showing available pages before & after the error).

 

 

Wadi
BlackBerry Development Advisor
Posts: 633
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: Google Maps error on OS 10.2

Hi there, 

 

I was going to suggest trying the sample app as well, but I see you've done that.

 

If your app isn't working, and the maps sample is then there must be some difference. Could be anything from using a bad API key, improper whitelisting in config.xml, and even just a coding error. From the screenshots it looks like the app is just crashing out.

 

Could you maybe try binding the map creation to a button, so when you click the button it then draws the map. Put your code inside of a try { } catch(error) { } block as well, to hopefully intercept what's happening in Web Inspector?