Comparing two locations for accuracy in Android

If you are developing a android application which uses android Location Service and you need to find best estimated location by comparing two locations, where one location is the currently obtained location and other is from the location fix then this post contains answer to your question. The below mentioned code contains a method isBetterLocation which will compare two locations and will return true if current location is more accurate than location fix. You might expect that the most recent location fix is the most accurate. However, because the accuracy of a location fix varies, the most recent fix is not always the best.

isBetterLocation method follows following criteria for choosing location fixes, you vary this criteria depending on the use-cases of the application and field testing.

  • Check if the location retrieved is significantly newer than the previous estimate.
  • Check if the accuracy claimed by the location is better or worse than the previous estimate.
  • Check which provider the new location is from and determine if you trust it more.

Must have apps for your android cell phone


We often buy smart phone and we are not able to make complete use of their potential. Here are some basic must have  apps which can unleash the capabilities of your smart Android Device and help you to use it better.

  1.   MX Player:   Best third party video player.
  2.  Power Amp: Best audio player app.
  3.  UC Browser: Super fast browser specially if Internet is slow.
  4.  Word Web: Smart Dictionary App.
  5.  Flashlight: Coverts your LED flash to Torch Light.
  6.  Super Backup: Best backup app for backing up messages, contacts, other apps.
  7.  Barcode Scanner: Allows you to scan barcodes.
  8.  Google Now: Instant google search.
  9.  Office 365: Full office Suit.
  10. Share via HTTP: This app allows you to share files among many devices simultaneously using WiFi network.
  11.  Google Drive: Easy upload on Google Drive.

Code for setting webview in android