Check Mobile App
Read now
Start a Project

Get the distance & duration between two locations in android?


We are getting distance & duration between two locations in Google map. We will find duration according to different Traveling Modes such as –

You’ll need to request the directions over HTTP. You can do this directly from Android, or via your own server.

Request the google map server with URL like-

with GET request method.

where “output” is a format of the response and parameter contains values.

Connection to communicate Map Server with URL.

Getting the response from the Google map server and parse response string to JSON format.

Getting distance & duration-

Sources: Google Maps Directions API

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


  • kajal
    hello sir can you provide full source code bcoz i m not getting where is response?
    • anchit (Moderator)
      We cannot share the code but what i can deduce from this article is that there is one line missing.

      String response = downloadUrl (url);

      I am adding this in the article as well.

  • css.php

    Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.

    Talk to Sales


    Live Chat
    Start a Project

      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home