Page 1 of 1

Problem with "the Google Directions API"

Posted: Tue Feb 25, 2014 11:46 am
by Ismael Pinós Farrús

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?


Problem with "the Google Directions API"

Posted: Tue Feb 25, 2014 12:52 pm
by Maryna Brodina

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


Problem with "the Google Directions API"

Posted: Wed Feb 26, 2014 9:09 am
by Ismael Pinós Farrús

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.


Problem with "the Google Directions API"

Posted: Wed Feb 26, 2014 12:07 pm
by Maryna Brodina

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?


Problem with "the Google Directions API"

Posted: Thu Feb 27, 2014 11:28 am
by Ismael Pinós Farrús

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.


Problem with "the Google Directions API"

Posted: Thu Feb 27, 2014 1:29 pm
by Maryna Brodina

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


Problem with "the Google Directions API"

Posted: Fri Feb 28, 2014 9:00 am
by Ismael Pinós Farrús

Okay, thank you.