Tuesday, 15 May 2012

android - Getting different latitude and longitude for one constant location -


I created an Android application to get the latitude and longitude of every 2 second location. This application works fine, but when I keep my Android device steady at one place, then I am getting different latitudes and longs for that point ... it is surprising that all these different coordinates Point to the place even if they are different.

For example a static location

I like

  latitude - 10.013499 Longitude - 76.3303451   < P> 2 seconds after  
  latitude - 10.0135014 longitude - 76.3303467   

after 2 seconds

  latitude - 10.0135001 Longitude - 76.3303451   

After 2 seconds

  Latitude - 10.0135011 Longitude - 76.3303466   

Can anyone tell me That's why I'm getting this .. .. we have a unique latitude and country for a given point Ntr how you can get.
My code is given below

  import java.util.concurrent.Executors; Import java.util.concurrent.ScheduledExecutorService; Import java.util.concurrent.TimeUnit; Import android App Importroid.os.Bundle; Import android.util.log; Import android.view.View; Import android.widget.Button; Import android.widget.Toast; Public class enhances AndroidGPSTrackingActivity activity {button btnShowLocation; stop; Double latitude, longitude; Int is = 0; Scheduled Excel service scheduler; // GPSTracker class GPSTracker GPS; Override public null on @reate (bundle saved instainstate) {super.naught (savedinstenstate); SetContentView (R.layout.main); BtnShowLocation = (button) FindById (R.id.btnShowLocation); Stop = (button) VVBIID (R.Stop); // show place button click event btnShowLocation.setOnClickListener (New View.OnClickListener) {Public Zero onClick (see arg0) {// Class Object Scheduler = Executors.newSingleThreadScheduledExecutor (); scheduler.scheduleAtFixedRate (New Runnable () {Public Zero run () {System.out.println ("sss"); // Log.i ("hello", "world"); ++; Log.i ("hello", "+ is"); runontrade ( New Runnabal) (Public Zero Run) {GPS = New GPSTracker (AndroidGPSTrackingActivity.this); Latitude = GPS; Gelituitued (); Rectitude = GPS. Langed (); Toast. GetApplicationCont Ext), "Your place is - \ nLat:" + Latitude + "\ nLang:" + Longitude, toast. LNNHHARAR. Show ();}}}}}}, 2, 2, time unit. SECONDS); }}); Stop.setOnClickListener (see new OnClickListener) {click on Public Zero (see Arg 0) {Scheduler.Shootdown (); OnDestoy ();}}); } @ Override Public Empty OnDesto () {Super. Onsteroy (); Toast. Make text (this, "service was destroyed ...", toast. LNNHH_LOG). Show (); } Public double getLatitude () {return latitude; } Public Zero Set Latitude (double latitude) {this.latitude = latitude; } Public Double Matching Amount () {Return Longitude; } Public Zero Set Length (double longitude) {this.longitude = longitude; }}    

GPS is not accurate. With the hardware in a normal phone, it can be around 10 meters or more at any time. So consistent readings will not be the same exact location.

The network provider is also bad - it could be up to 1km of inaccuracy.

No comments:

Post a Comment