Android Question Google direction API language

marcick

Well-Known Member
Licensed User
Longtime User
I'm playing with this API to get a route between two points.
The HTTP request is for example:

B4X:
http://maps.googleapis.com/maps/api/directions/json?origin=45.56161,8.94109&destination=45.5631,8.94911&sensor=false

If I try it on my PC browser, i get the JSON containing the instructions in my language (italian)

but if I try it in B4A, the instructions are in english. I tryed also including in the request the parameter "&region=it" but the resut is again english.

Any hints ?
 

rboeck

Well-Known Member
Licensed User
Longtime User
Try the language parameter, not the region: add &language=it at the end of your html request...

Greetings from austria
Reinhard
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
Yes, I was reading so many times the documentation and didn't see the language option ..... thanks.
Do you know also how to manage the instruction if I want to use text to speech ?
I mean, for example, if the instruction is "go ahead 0.5 km then turn left", then, when you are close to that point I should repeat "turn left". Would need two separate instruction but the api returns just one.
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
I don't know exactly what you are doing but, if you get text with the directions, you can just read it, now, if you want to read it depending on how far are you from the turn (let say to turn left) then you have to get that info from the GPS (or any other means), now, that sound a little complicated.
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
I need the navigation function inside my app. I was using the intent google.navigation to launch the external navigator but I want to abandon it, I have some troubles and also it is not official, maybe it will disappear at all in some future Google update ....
So, I have now the route with Google api and the polyline drawn on the map. needs just to manage the vocal instruction.
Yes, with GPS I can know when I'm close to a point, but I don't have the separate instruction to repeat.
Suppose the first segment is from A to B, I just have the instruction to say at point A " go ahead for 0.5 km then turn left" but I don't have the text to repeat when I'm close to B, that should be "turn left".
Did I explain clear ?
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
If you are launching Google Navigator it should work, I don't understand what you mean by "it is not official, maybe it will disappear at all in some future Google update", I doubt Google will get rid of Maps/Navigation. Now, if you are trying to create your own navigation system, well, lots of luck to you.
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
I need to launch a navigator with a couple of coordinates (not an address).
I'm using now the Google.navigation intent but is not documented
http://developer.android.com/guide/appendix/g-app-intents.html
actually it works, but who know how long ?
To stay on the official line you should now launch the map intent and then (inside Maps) activate the navigation. But with the last update of Maps 7.x the intent works only passing an address as destination. If you pass instead coordinates, you see the map centered but no marker ....
Many many problems. This is why I'm working on a built in navigation function inside my app.
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
Search for user me68; some month ago he was working exactly on the same problem; he also published the code, to decode polylines for use on maps. Maybe he had success with his navigation.
I dont understand your problems with Maps 7.x; i also use navigation with Maps 7.4.0 and currently transmit the starting adress in coordinates as long and lat values and dont see any problem...
If the problems in maps really exists, than maybe it would be easier, to use reverse geocoding: you send coordinates and get the nearest street adress.
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
Hi, thanks everybody, I'll ask that user. I would like to have an integrated navigation system and get rid of compatibility issue.
P.s. if I pass two coordinates separated by comma to the maps intent, I see the map centered on that position, but no marker. prior of 7.x version was working ok instead.
But I'll check again, thanks.
Marco
 
Upvote 0
Top