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
kenhcwoo
Posts: 17
Registered: ‎11-15-2011
My Device: Blackberry

Webworks vs Browser performance issues

Hey all, I started developing a webworks app and have been testing it on some of the smartphone simulators.

 

One thing I have noticed is that loading the site in the browser is a lot faster than a webworks app. I'm not doing anything complicated, just textboxes and buttons, but it seems that it takes a lot longer to load as a webworks app.

 

Another problem I'm having is that I'm trying to use the Google Maps API to show a map, but it doesn't seem like it works in the webworks app. I have my config.xml set to allow access to uri="*" and can't get a map to show up (I pretty much followed a lot of samples using the API). I have the z-index set to 0 as I read that it's a fix for os 5, but that didn't work for me.

 

The maps show up when I browse to the app using the browser (I am using apache to host my app on localhost).

 

The last thing I'm doing is using jQuery to make a call to a local server. Again, this works on the browser, but the webwork apps won't make the call. My server is just a php script to log a timestamp and parameters passed. This works pretty well on an 9700 - os 5 simulator, but again 9800 - os 6 and 9930 - os 7 simulators won't register the call on the server.

 

Any ideas? Or are the simulators not the best way to test. I'm not really sure how to debug the javascript using the smartphone simulators without just 'alert'-ing everything.

Developer
jdnoprada
Posts: 68
Registered: ‎03-01-2011
My Device: Not Specified

Re: Webworks vs Browser performance issues

Hello kenhcwoo,

 

First of all, welcome to webworks development!

 

About your issue with using the smartphone simulator, there's now the Ripple environment where you can test, package and sign your applications. Visit here for more details on using Ripple development and happy coding :smileywink:.

Developer
kenhcwoo
Posts: 17
Registered: ‎11-15-2011
My Device: Blackberry

Re: Webworks vs Browser performance issues

[ Edited ]

Thanks for the reply. I have been using ripple, and everything looks fine on ripple. Maps work, AJAX calls work, Geolocation works. I'm hosting the app on an apache server if that changes anything.

It's when I get to the simulators where the problems start happening.

Contributor
marcderosa
Posts: 12
Registered: ‎02-17-2012
My Device: developer

Re: Webworks vs Browser performance issues

Its possible to get Google Maps to dispaly in a WebWorks application, on one of the (non Ripple) emulators.

First you will probably want to open up access permissions with a

<access uri="*" subdomains="true" />

You dont have much here. Google is storing the assets for their maps at a vareiety of urls and those urls can change at any time. You have to open up access permissions to all urls or your app wont be future proof.

After that you should be able to get your app off the ground by starting with the google maps "hello world" example (slightly modified)

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width,target-densitydpi=device-dpi,user-scalable=no,initial-scale=1.0">
    
    <title>hello world</title>
    

    <style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
      #map_canvas { height: 100% }
    </style>
    <script type="text/javascript"
        src="http://maps.googleapis.com/maps/api/js?sensor=true">
    </script>
    <script type="text/javascript">
      function initialize() {
          var myOptions = {
          center: new google.maps.LatLng(-34.397, 150.644),
          zoom: 8,
          mapTypeId: google.maps.MapTypeId.ROADMAP
          };
          var map = new google.maps.Map(document.getElementById("map_canvas"),
          myOptions);
      }
    </script>
</head>
  <body onload="initialize()">
    <div id="map_canvas" style="width:300px; height:300px"></div>
  </body>

</html>

Swap in the standard blackberry meta tags and then change the width / height of the div from 100%/100% to some specific pixel width /height. My experience is that unless you specifically set the width and heigh you will just get a thin band of barely visible something at the top of the emulator window.

Lastly so you have access to the web make sure you have the MDS service installed and running as described in the Help -> Simulator Help Index of your simulator. Otherwise you will get a very confusing html 500 error back from your request - ie it will appear that you have connectivity (you dont) and it will appear that an error happened on the Google severs (didnt happen).

You should also be aware that if you plan on having more dynamic maps -- adding overlays, panning, zooming -- quite a few people seem to have run into low memory errors when doing that type of stuff. It appears that amount of memory available to WebWorks apps on the current OS's is not quite sufficient to support too much user zooming / panning, whatever. So if your planning supplying that sort of a WebWorks application to customers ---- dont.