title: requestLocationUpdates for count traveled meters
body: <p>UPDATE:
  My real class looks like this and it works (it toast me dis variable from onLocationChange method). But I cant reach this variable in MainActivity - it always throw me 0.0 - Is it possible that this class destroy this variable at some time?</p>
  
  <pre><code>public class GPStracker implements LocationListener {
  
      Context context;
      double plat;
      double plon;
      double clat;
      double clon;
  
      public double dis;
  
      public GPStracker(Context c) {
          context = c;
      }
  
      public Location getlocation() {
          if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
              Toast.makeText(context, "Uprawnienia nie przyznane", Toast.LENGTH_SHORT).show();
          }
  
          LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
          boolean isGPSenabled;
          isGPSenabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
  
          if (isGPSenabled) {
              lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, this);
              Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
              return location;
          } else {
              Toast.makeText(context, "Proszę włączyć GPS", Toast.LENGTH_LONG).show();
          }
          return null;
      }
  
      @Override
      public void onLocationChanged(Location location) {
          clat = location.getLatitude();
          clon = location.getLongitude();
          if (clat != plat || clon != plon) {
              dis += getDistance(plat, plon, clat, clon);
              plat = clat;
              plon = clon;
  
              setDis(dis);
          }
          Toast.makeText(context, String.valueOf(dis), Toast.LENGTH_SHORT).show();
      }
  
  
      @Override
      public void onStatusChanged(String s, int i, Bundle bundle) {
  
      }
  
      @Override
      public void onProviderEnabled(String s) {
  
      }
  
      @Override
      public void onProviderDisabled(String s) {
  
      }
  
      public double getDistance(double lat1, double lon1, double lat2, double lon2) {
          double latA = Math.toRadians(lat1);
          double lonA = Math.toRadians(lon1);
          double latB = Math.toRadians(lat2);
          double lonB = Math.toRadians(lon2);
          double cosAng = (Math.cos(latA) * Math.cos(latB) * Math.cos(lonB - lonA)) +
                  (Math.sin(latA) * Math.sin(latB));
          double ang = Math.acos(cosAng);
          double dist = ang * 6371;
          return dist;
      }
  
      public double getDis() {
          return dis;
      }
  
      public void setDis(double dis) {
          this.dis = dis;
      }
  }
  </code></pre>
  
  <p>I'd like to ask (maybe thats a stupid question), but i'm trying to count meters of travel using gps provider. And right now i'm thinnking about use requestLocationUpdates maybe in this way:</p>
  
  <pre><code>int i;      
        requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, this);
  and 
      public void onLocationChanged(Location location) {
  i++
  }
  </code></pre>
  
  <p>So according to google references, it should auto update my int i every new one meter. Thats right? Or maybe i think wrong? Thats looks so easy to count meters of travel but i'm not sure will it work and whether it will be accurate... Any suggestions?</p>