Pergunta

Can i get direction between 2 points with using Google Maps v2 in my Android application ?

I found Polyline but i don't want to draw a line between 2 points.

I found a solution which is using Intent. It can solve this problem but it is not useful because this solution is starting another map application and I want to show direction in my application. Can i do this ?

Foi útil?

Solução

You cannot get directions using just the Google Maps V2 api. You should use the Google Directions API direction request call. This will return the raw direction data in json which would allow you to draw a Polyline for the directions on the map or show the data in any format you would like.

Outras dicas

There isn't any method to do it because it envolves several computing that must be done in Google Maps servers (and they don't allow you to do so many without paying if you hold a business).

So, the only way is making a petition to google maps servers as they describe in the Google Maps Api documentation that @Bobbake4 linked. Then, you'll receive several coordinates that you'll use to draw a polyline which represents your route.

Hopefully, someone has already coded everything and shared gently with us here https://stackoverflow.com/a/15643705/1516973

That's absolutely the best answer covering Android Google Maps routing that I've found in Stack Overflow, so thanks to @Akexorcist and @emil-adz for it.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top