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
Contributor
Posts: 13
Registered: ‎01-21-2013
My Device: BB 10
My Carrier: -

Placing a marker on Google Maps kills my app

[ Edited ]

Hello!

 

I'm working on an application that is using google maps APIs. I have no trouble in inserting the map and operating with it (panning, zooming ect..). However, my application crashes every time i try to put a marker on the map.

 

There are no problems when debugging in ripple, it just works fine. My app crashes (the screen becomes completely black, not only the map) on Blackberry 10 Dev Alpha Simulator and on the Blackberry Dev Alpha B device. The only thing I can do after the crash is to close my application.

As I said, Ripple doesn't give me any error, and shows me my marker correctly on the map.

 

I invite you to try this test code:

 

index.html

<html>
<head>
<link rel="stylesheet" type="text/css" href="css/bbui.css" />

<!-- GOOGLE MAPS API -->
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>

<script type="text/javascript" src="lib/bbui.js"></script>
<script type="text/javascript" src="local:///chrome/webworks.js"></script>

<script type="text/javascript">
var domReadyCallback = function() { };

document.addEventListener('webworksready', function (e) {
bb.init({
ondomready: function () {
domReadyCallback.call();
}
});

bb.pushScreen('test-map.html');
}, false);
</script>
</head>
<body>
</body>
</html>

 

test-map.html

<div data-bb-type="screen" data-bb-effect="fade">
    <script type="text/javascript" src="js/test-map.js"></script>

    <div data-bb-type="button" onclick="putMarker();">Place the marker</div>
    <div id="map" style="width: 700px; height: 900px"></div>
</div>

 

 

js/test-map.js

var myMap;

 

domReadyCallback = function () {
    myMap = new google.maps.Map(document.getElementById("map"), {
       zoom: 6,
       mapTypeId: google.maps.MapTypeId.ROADMAP,
       center: new google.maps.LatLng(5, 5)
    });
};

 

function putMarker() {
    var newMarker = new google.maps.Marker({
        map: myMap,
        position: new google.maps.LatLng(5, 5)
    });

}

 

Just press the "Place the marker" button and see the app crashing.

 

In my config.xml I already have  <access uri="*" subdomains="true" />

 

I really hope you can help me!

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

Re: Placing a marker on Google Maps kills my app

Have you tried using Web Inspector and running the app on your Dev Alpha B?  If there are any runtime errors that will show up in the console.log. https://developer.blackberry.com/html5/documentation/web_inspector_overview_1553586_11.html

 

Also, you can try my maps sample from GitHub to compare - https://github.com/blackberry/BB10-WebWorks-Samples/tree/master/Maps

 

Contributor
Posts: 13
Registered: ‎01-21-2013
My Device: BB 10
My Carrier: -

Re: Placing a marker on Google Maps kills my app

At this moment I don't own Dev Alpha B (it was my friend's one).

I've run web inspector on the simulator and unfortunately there are no errors. My console is completely clean. Neither google maps returns any error.

The screen just becomes black and nothing else happens.

 

 

The most shocking thing is that I've tried on the simulator the maps sample app, and it crashes in exactly the same way. No problems when moving on the map, but after clicking "Nearby Pubs" the screen turns black. (Nearby Pubs is supposed to place markers on the locations of the bars near me).

The other maps and their markers work correctly (I didn't try bing maps because I don't have the API key).

 

As previously, it all works fine on Ripple.

 

In my project I'm forced to use Google Maps API, so I must find a way to make it work.

Contributor
Posts: 13
Registered: ‎01-21-2013
My Device: BB 10
My Carrier: -

Re: Placing a marker on Google Maps kills my app

[ Edited ]

Nobody can help me?

At least, tell me if i'm the only one who see the sample "maps" application crash on the simulator after pressing the "Nearby Pubs" button. That will allow me to understand if I'm the only one with this problem or not.

Maybe Google has updated their APIs and now these are unsuitable for BB10 for some reasons.

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

Re: Placing a marker on Google Maps kills my app

I can assure you that it isn't crashing on the device, just re-tested it.