Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6861793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:34:51+00:00 2026-05-27T02:34:51+00:00

In my iPhone app I’m using MapKit to show the user where he is,

  • 0

In my iPhone app I’m using MapKit to show the user where he is, i also want to show him the total time and duration
to his destination.
Can i use Google direction API to do that?
What I’m planning to do is to ask for direction every few seconds (up to 2500 requests i know..)
and only show the “direction” and “duration” values from the response to the user.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:34:52+00:00Added an answer on May 27, 2026 at 2:34 am

    Yes you can.

    The JSON response includes distance and duration, e.g.

    "duration": {
        "value": 74384,
        "text": "20 hours 40 mins"
    },
    "distance": {
        "value": 2137146,
        "text": "1,328 mi"
    },
    

    I would suggest only calling the API every minute or so. You can use linear interpolation to work out the in-between values (your will have to estimate the speed to decrease distance by the right amount).

    To implement this….

    1. Frist save the time when the result is returned.

      self.responseTime = [NSDate date];

    2. Calculate the speed that google used.

      Speed = Distance / Time

      So in the example the raw units are meters and seconds so

      Speed = 2137146 / 74384 = 28.7... ms^1

    3. Use NSTimer to get a recurring callback every so often. In the callback you need:

      1. Decrease time by the elapsed time since the response time.

      2. Decease the distance by the calculated speed * elapsed time since the response time.

      3. Update the labels.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my iphone app is using soap web-services. I want to know how it would
In my iPhone App I want to implemented functionality as shown below user can
My iPhone app formats an NSDecimalNumber as a currency using setCurrencyCode, however another screen
My iphone app downloads user specific data from our web server. How can I
My iPhone app will have read-only system data AND read/write user data (stored either
The iPhone app I am working on captures images in series within certain user-defined
We have created an iPhone app which our client wants to show on a
My iPhone app currently uses core data. I want to create an online database
In iPhone App, Can we take pictures at some perticular time intervals programmatically by
My iPhone app has two boxes with content. When user switch the orientation of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.