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

  • Home
  • SEARCH
  • 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 5951877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:36:02+00:00 2026-05-22T17:36:02+00:00

The android’s distanceTo() and distanceBetween() function gives results when I reach the destination lat

  • 0

The android’s distanceTo() and distanceBetween() function gives results when I reach the destination lat and lon. But I need to cover the case when latitude and longitude may not be changed (e.g. if I walk in the street with high buildings around, enter the building or walk short distance by taking more turns). For those conditions how to calculate distance in android?

When I was searching through stackoverflow others answers, I gone through here.

I tried the following answer. The code is good and fine but when I tried to calculate distance by that code everytime it gives a constant value even when I am not walking.

Please help me in calculating the distance between two points

  • 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-22T17:36:03+00:00Added an answer on May 22, 2026 at 5:36 pm

    When you enter the building you have GPS lat/long, but after that it will not change because there is no GPS coverage. So, question is how to handle such a case, having just last position. I would approach that interesting issue this way:

    • Use WiFi networks info for location as well (not just GPS).

    • Use sensors. You have orientation and accelerator sensors. I remember some phones having feature of number of steps counting (I had that on SonyEricsson without GPS).

    • Accelerator sensor may give you info if person is moving and help you to count the number of steps (you need to take some average step distance value estimate). You can easily conclude if person is in the elevator, and if he is going up or down, and roughly estimate number of floors.

    • Orientation sensor may give you info about direction of movement change (turning around the corner).

    • GSM signal strength based location. NeighboringCellInfo from android.telephony gives you information about RSSI (Received Signal Strength Indication) for cells around you, but for accurate calculation of the position (approx 50 m precision) based on triangulation you need exact position of Base stations (which you cannot get without support from the operator).

    It is understood how inaccurate such estimation may be, but I see no other approach.

    In any case, stuff for lots of fun exploring/developing.

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

Sidebar

Related Questions

[Android Newbie alert] I need to capture the contents of a WebView in a
Android APK-Files are not binaries but byte-code-files. So is it possible to install the
Android documentation for SMSManagers sendTextMessage function public void sendTextMessage (String destinationAddress, String scAddress, String
Android function PHP example: function HaHa($a = Test) { print $a; } The question
Android provides various packages for testing like AndroidTestCase ApplicationTestCase InstrumentationTestCase ActivityInstrumentationTestCase2 ActivityTestCase I need
android:label parameter is displayed just under your icon on the home screen, but I
Android tells me that The application has stopped unexcepetedly, but there are no error's
Android’s Notepad tutorial Notepadv3 opens its database but never explicitly closes it. To make
Android is a software stack but not an OS. as stated by developer.android.com What
Android VideoView works when I disable rtsp authentication from server side. But when authentication

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.