1

I'm building a mobile application on Phonegap, implementing jQuery Mobile. I'm building the same App on Blackberry, Ios and Android. The Ios and Android Google Maps work as expected: you can click on the map and I have an event listener calling a webservice on that event. But on blackberry, the map is not scrollable (it's fixed) and the map is not clickable. Any ideas?

My framework is extensive but the relevent code is below:

GpsLinkClicked: function()
    {
        kmTolerance="100";

       model.getLocation(); 

       setTimeout(function()
       {
           doneWithSections=app.save("doneWithSections", '');

           var script = document.createElement("script");
           script.type = "text/javascript";
           script.src = "http://maps.googleapis.com/maps/api/js?key=mykeyishere&sensor=false&callback=model.initializeMap";
           document.body.appendChild(script);


       },1000);
    },


    initializeMap: function() 
    {
            currentLocation=app.get('currentLocation');
            currentLocation=$.parseJSON(currentLocation);

            var myLatlng = new google.maps.LatLng(currentLocation.latitude, currentLocation.longitude);

            var mapOptions = {
              zoom: 16,
              center: myLatlng,
              mapTypeId: google.maps.MapTypeId.ROADMAP
            }

            var map = new google.maps.Map(document.getElementById("content-dataview"), mapOptions);

            var marker = new google.maps.Marker({
                position: myLatlng,
                map: map,
                title:"My Location"
            });

            google.maps.event.addListener(map, 'click', function(event) {
                model.mapClicked(event.latLng);
            });

            $("#content-dataview").attr("style", "height: 480px");
            $("#content-dataview").trigger( "updatelayout" );
      },


      mapClicked: function(location) 
      {
          loc=JSON.stringify(location);
          locObj=$.parseJSON(loc);

          var data={
              latitude: locObj.kb,
              longitude: locObj.lb,
              kmTolerance: "0.2"
          };

          model.callAjax("GetLookupsWithGps", "POST", JSON.stringify(data));
      },
  • 2
    In my experience PhoneGap development is a waste of time for anything with a complexity > 1. You're better off writing native versions (in fact will probably be a quicker, more pleasant dev experience, BlackBerry withstanding) – darryn.ten Mar 26 '13 at 14:27
  • That's true - believe me, I know. However my client has insisted on Phonegap... –  Mar 26 '13 at 14:29
  • 2
    show your client this post [Native vs. Hybrid](http://stackoverflow.com/questions/14065610/struggling-between-native-and-phonegap-simple-app-requirements) ;) – Omar Mar 26 '13 at 14:32

0 Answers0