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

New Contributor
Posts: 7
Registered: ‎02-28-2011
My Device: 8700c
My Carrier: idea

Dynamic map in WebWorks

[ Edited ]

Hi all,



How can I show dynamic map in my webworks aplicatiobn for BlackBerry? I have tried different ways to acomplish that and nowreached nowhere.




#1: Google Maps JavaScript API V2


     var map = new GMap2(document.getElementById("map_canvas"));

Error: GMap2 is undefined




#2: Tried navigator.geolocation.


    navigator.geolocation.getCurrentPosition(geolocationSuccess, geolocationError);

Problem: Never executes the events geolocationSuccess and  geolocationError


Please put your thoughts and help me.





Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Dynamic map in WebWorks

For a tutorial on how to use Geolocation you can check out the following link:



Can you also post up the OS version number you are attempting to use?  For dynamic mapping can you explain the features you would like to use?  

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Contributor
Posts: 7
Registered: ‎02-28-2011
My Device: 8700c
My Carrier: idea

Re: Dynamic map in WebWorks




Thank you very much for your time to look into this.



I have followed same steps in the tutorial and I found the events "geolocationSuccess" and "geolocationError" never fires, event though the line

navigator.geolocation.getCurrentPosition(geolocationSuccess, geolocationError, options);

executes fine.




Here I am pasting my relevant code:


function locationUpdated() {
    if (navigator.geolocation !== null) {
        var options;
        alert("navigator.geolocation.getCurrentPosition executing");
        navigator.geolocation.getCurrentPosition(geolocationSuccess, geolocationError, options);
        alert(navigator.geolocation);  // Got Object
    else {
        alert("HTML5 geolocation is not supported.");

function geolocationSuccess(position) {
    alert("Inside Success");  // Not getting alert even after waiting long time

function geolocationError(error) {
    alert("An unexpected error occurred [" + error.code + "]: " + error.message); // Not getting alert even after waiting long time



I am having script references as shown below on page:


    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

    <script type="text/javascript" src="Scripts/html5_init.js" id="html5_init"></script>



Tried adding Permission for domains in config.xml

  - added http://code.google.com

  - added http://maps.google.com

  - allowed almost every features for these domains and localhost.

  - Set the GPS location in simulator also


I am stuck now that "why the events not firing" ?


I am using BlackBerry 9550 Simulator.


I need dynamic map and street view in my webworks application.