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 6556133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:54:20+00:00 2026-05-25T12:54:20+00:00

I am working on gps tracking in android to track the user location and

  • 0

I am working on gps tracking in android to track the user location and provide the feature to record the track.I am able to draw path now i want to calculate the track distance and time with that like suppose user start tracking record and move to another location now i want to calculate total distance and time travel for from start to end position (with user location update) in google map. I have function which calculate the distance for 2 position but that not fit for my route, because route are in polyline and it’s flexible lat/lng position. is their any api or any function or services provide by google for that. any help or suggestion are appreciate.

  • 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-25T12:54:20+00:00Added an answer on May 25, 2026 at 12:54 pm

    I would create a class called waypoint

    class WayPoint
    {
       DateTime depart; //some date time container
       DateTime arrive; //some date time container
       Coordinate position; //some gps coordinate
    }
    

    Then create a list of these classes which allows inserting of elements at any position which is helpful if your route changes:

    List<WayPoint> journey = new ArrayList<WayPoint>();
    
    //just add your waypoints
    
    journey.add(startWayPoint);
    journey.add(wayPoint_1);
    journey.add(wayPoint_2);
    //...
    journey.add(wayPoint_n_minus_2);
    journey.add(wayPoint_n_minus_1);
    journey.add(endWayPoint);
    

    Then convert to array and calculate the totals:

    WayPoint[] wayPoints = journey.toArray();
    
    double total_distance = 0.0f; //distance in metres
    double total_travel_time = 0.0f; // time in hours
    
    //start at index 1 because there are n-1 segments
    if(wayPoints.length>1)
    foreach(int i=1; i<wayPoints.length;i++)
    {
      total_distance += calcDistanceBetween(
          wayPoints[i-1].position,
          wayPoints[i].position);
    
      total_time += calcTimeInHoursBetween(
          wayPoints[i-1].depart,
          wayPoints[i].arrive);
    }
    
    log.d("Total Distance",String.valueOf(total_distance));
    log.d("Total Travel Time",String.valueOf(total_travel_time));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on GPS system for android. I am able to find the
I am working on location based application for android .In that i want to
I'm having an Android GPS project for my CS class. Right now I'm working
Working on a tracking application using GPS. It is all fine, but sometimes because
Hi im working on an app that uses GPS location. My testing devices are
I am currently working on a GPS tracking App (only the distance, not storing
I am working on a Widget which will get the Current GPS location and
I am working on an Android Application where I am trying to track movement
I'm working on asset tracking application. I have devices that send update on GPS
I'm working on an Android app that uses high-resolution GPS data. It's designed to

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.