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
Trusted Contributor
Posts: 109
Registered: ‎11-15-2011
My Device: blackberry 9800
My Carrier: beginner developer

route with mobile 9300 on google maps

[ Edited ]

Hello,

 

I want to display the route between two points. In 9800, I can get the route and I have no problems but in 9300 I can't get the route.

I use javascript V3. Any one has the same problem or can display teh route in 9300 using javascript???

 

Thanks

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: route with mobile 9300 on google maps

Can you post a sample and the full OS version that you are using on the 9300?

Tim Windsor
Open Source Technical Lead
Trusted Contributor
Posts: 109
Registered: ‎11-15-2011
My Device: blackberry 9800
My Carrier: beginner developer

Re: route with mobile 9300 on google maps

+ " calcRoute: function(current_lat,current_long,param_latitude,param_longitude) {\r\n"

+ " var request = {\r\n"
+ " origin: new google.maps.LatLng(current_lat, current_long),\r\n"
+ " destination: new google.maps.LatLng(param_latitude, param_longitude),\r\n"
// +"waypoints: waypts,\r\n"
+ " optimizeWaypoints: true,\r\n"
+ " travelMode: google.maps.DirectionsTravelMode.DRIVING \r\n"
+ "};\r\n"

+ " var _SELF = this;\r\n"
+ "this.directionsHelper_.route(request, function(response, status) {\r\n"
+ " if (status == google.maps.DirectionsStatus.OK) {\r\n"

+ " _SELF.directionsDisplay_.setDirections(response); \r\n"
+ " return;\r\n"
+ " }\r\n"
+ " console.log('Directions Status: ' + status);\r\n"
+ " });\r\n"
+ " },\r\n"
+

"init: function(mapid,current_lat,current_long,param_latitude,param_longitude) {\r\n"
+

" this.directionsHelper_ = new google.maps.DirectionsService();\r\n"
+ "this.directionsDisplay_ = new google.maps.DirectionsRenderer();\r\n"
+

" var center = new google.maps.LatLng(current_lat,current_long);\r\n"
+ " var myOptions = {\r\n"
+ " zoom:7,\r\n"
+ " mapTypeId: google.maps.MapTypeId.ROADMAP,\r\n"
+ " center: center\r\n"
+ "}\r\n"
+ "this.map_ = new google.maps.Map(document.getElementById(mapid), myOptions);\r\n"
+ "this.directionsDisplay_.setMap(this.map_);\r\n"
// +"directionsDisplay_.setPanel(document.getElementById(\"directionsPanel\"));"

+ " this.calcRoute(current_lat,current_long,param_latitude,param_longitude);\r\n"
+ "}\r\n"
+ "};\r\n"

 

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: route with mobile 9300 on google maps

Have you tried looking at this in WebInspector? I tested it on my device and found the phone was getting a 403 response for one of the script inclusion files. This means that most of the javascript is not getting loaded. Just want to confirm we are seeing the same problem.

Tim Windsor
Open Source Technical Lead
Trusted Contributor
Posts: 109
Registered: ‎11-15-2011
My Device: blackberry 9800
My Carrier: beginner developer

Re: route with mobile 9300 on google maps

I get the map but I didn't get the route and I didn't get 403 response.

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: route with mobile 9300 on google maps

Yeah, I get the map and no route, but if I connect to the phone over WebInspector, I see that the Browser is getting a 403 when it tries to load the "http://maps.gstatic.com/cat_js/intl/en_ALL/mapfiles/api-3/9/2/%7Bcommon,map,util,geometry,directions..." file.

Tim Windsor
Open Source Technical Lead
Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: route with mobile 9300 on google maps

Definitely something strange here.

 

There were several files that were not loading, getting a 403 back. However, I loaded them individually in the Browser then refreshed the map and everything appeared properly. My initial theory is that this is something I'm going to have to follow up with Google on.

 

In case this is urgent and I can't get it resolved with Google in a short time, you may want to look at some alternatives. There are some very fast and lightweight mapping solutions that are better than Google on mobile: http://devblog.blackberry.com/2012/05/lightweight-maps-for-mobile-part-1/

Tim Windsor
Open Source Technical Lead
Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: route with mobile 9300 on google maps

There seems to be a problem related to where the sample is hosted. When I host the file on a local webserver and access it from the phone, I get the map only with no overlays or route. However, if I put it up on DropBox, then it works fine.

 

Also, after having loaded it successfully from dropbox, the scripts are cached and the local webserver starts to work.

 

Can you try hosting it on a public domain somewhere?

Tim Windsor
Open Source Technical Lead