-1

I am using GPS Tracker class and I want to get an accurate current location.

But every time, I am getting a different location (20-meter accuracy).

GPS Tracker Class: http://eclatsol.net/GPSTracker.java

Code :

gpsTracker = new GPSTracker(getActivity());
if (gpsTracker.canGetLocation()) {
   mLatitude = gpsTracker.getLatitude();
   mLongitude = gpsTracker.getLongitude();
}

at that time I am doing Indoors testing.

MLavoie
  • 9,671
  • 41
  • 36
  • 56
Pratik Bhalodiya
  • 736
  • 7
  • 14
  • 2
    Which gps tracker class? – greenapps Oct 12 '16 at 09:07
  • Turn on High accuracy location services – Tim Oct 12 '16 at 09:09
  • @TimCastelijns i did high accuracy location services. and i found that bug in Ola application also – Pratik Bhalodiya Oct 12 '16 at 09:10
  • 1
    Sorry but can you elaborate where that tracker class comes from? Which import? Never seen before. – greenapps Oct 12 '16 at 09:11
  • then this is the best you're gonna get – Tim Oct 12 '16 at 09:13
  • @greenapps i am using LocationListener – Pratik Bhalodiya Oct 12 '16 at 09:18
  • import android.location.Geocoder; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; that are my imports – Pratik Bhalodiya Oct 12 '16 at 09:21
  • You wrote a bad post. You are not giving any info about your use case. Indoors? Outdoors? In the woods? Moving? You complain about software but most probably you have to complain about the quality of the gps chip in your Android device. Or about the impossibility of a gps chip to calculate the position when static. – greenapps Oct 12 '16 at 09:54
  • _"I am using GPS Tracker class"_ Then that's probably the root cause of your problems. _"And i am using LocationListener"_ But are you using it properly? We can't know that without any code. _"at that time i am doing Indoors testing"_ GPS doesn't really work indoors. – Markus Kauppinen Oct 12 '16 at 10:23
  • @greenapps please open http://eclatsol.net/GPSTracker.java , i am using that class for tracking gps – Pratik Bhalodiya Oct 12 '16 at 10:43
  • @MarkusKauppinen please see that class eclatsol.net/GPSTracker.java – Pratik Bhalodiya Oct 12 '16 at 10:48
  • 1
    The problems of the infamous "GPS tracker" code is explained in detail [in this blog post by Gabe Sechan](http://gabesechansoftware.com/location-tracking/). It continuously keeps causing headache for developers that look for an "easy solution" and end up using bad example code. – Markus Kauppinen Oct 12 '16 at 10:48

2 Answers2

2

You could refer Fused Location API and it's high accuracy option. The documentation says,

PRIORITY_HIGH_ACCURACY - Use this setting to request the most precise location possible. With this setting, the location services are more likely to use GPS to determine the location.

Now i'v also tested (indoor, near balcony) on old device (Samsung Galaxy S3). I'm receiving location updates between 5m and 15m accuracy. The tested code from, googlesamples/android-play-location

blackkara
  • 4,900
  • 4
  • 28
  • 58
0

GPSTrackerclass private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; private static final long MIN_TIME_BW_UPDATES = 1000 * 5;