Ismael Pinós Farrús
Posts: 0
Joined: Thu Jan 30, 2014 11:41 am

Problem with "the Google Directions API"

Hi, I have a problem with the tutorial "Building a mobile app with Google Maps & the Google Directions API" (http://docs.appery.io/tutorials/build...)

Some time ago I did it on Appery.io and I was all right, but now I need to make it in Progress, and not works.
I have noticed that some aspects change from one to the other.
I think I missed when declaring variables and call the function by clicking on the button.

I mean, the tutorial says that to add the following javascript:
**
var sourceAddress = Appery("inputSource").val();
var destinationAddress = Appery("inputDestination").val();
var map = Appery("directionsMap").gmap;
var panel = Appery("directionsPanel")[0];
displayDirections(sourceAddress, destinationAddress, map, panel);
**
and I have this (changing the tags):
**
var sourceAddress = $('[dsid="inputOrigen"]').val();
var destinationAddress = $('[dsid="inputDesti"]').val();
var map = $('[dsid="googlemap"]').gmap;
var panel = $('[dsid="htmlIndicacions"]')[0];
/alert ("sourceAddres: " + sourceAddress + " - destinationAddress: " + destinationAddress);/
displayDirections(sourceAddress, destinationAddress, map, panel);
**

  • Name tags are correct

  • The alert print the variables (sourceAddress and destinationAddress) that I have introduced on the inputs correctly

    but thereafter, the map stays in the position it had started, and shows no the route in the imageand neither the directions in the table.

    I have the rest of the tutorial done exactly as it says.

    How can I do it?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Problem with "the Google Directions API"

Hello! Are there any errors in console? On wat event you invoke this code?

Ismael Pinós Farrús
Posts: 0
Joined: Thu Jan 30, 2014 11:41 am

Problem with "the Google Directions API"

Is exactly like the tutorial. A map, two inputs and a button.
When de page is loaded, runs a javascript code (initialize();), then the map preview load works succesfully. But when I put the two locations in the inputs and I click the button (which execute the javascript code that I post in the previous message) the app freezes.

If I test it in the browser, don't work anything (no even the map preview) and I can see repeatedly this error code ("Uncaught ReferenceError: google is not defined").
I suppose that happens because is in the browser, and when I test it in the tablet, some errors disappear, or are not essential for the proper functioning of the map preview, but yes in the search.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Problem with "the Google Directions API"

Hello! Please check in console what Google service returns. Perhaps Google just can't build the route. Perhaps you've specified incorrect address. Did you try any other addresses? What addresses did you try?

Ismael Pinós Farrús
Posts: 0
Joined: Thu Jan 30, 2014 11:41 am

Problem with "the Google Directions API"

I'm sorry, but I don't know what you want to say with "check in console what Google service returns".
I have tried lot of diferent and known routes, like Barcelona-Madrid, Paris-Berlin...
When I did it in Appery.io, it worked perfectly. Even with routes from little town to town.

I still thinking the problem can be with de compatibility between Progress Mobile and the Appery code.

Thanks for all.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Problem with "the Google Directions API"

Hello! Sorry, but you would need to contact Progress support.

Ismael Pinós Farrús
Posts: 0
Joined: Thu Jan 30, 2014 11:41 am

Problem with "the Google Directions API"

Okay, thank you.

Return to “Issues”