Raj Raman
Raj Raman

Reputation: 9

Android app latitude and longitude values are coming even though no network or gps

I have written an android app to find latitude and longitude. latitude and longitude values are coming even though no network or gps. I think previous latitude and longitude values are stored in cache. How to clear cache values.

Upvotes: 1

Views: 923

Answers (1)

Reno
Reno

Reputation: 33792

This will work on Samsung phones. :

private void deleteGpsData(){
        /* Cold start */
        Bundle extra = new Bundle();
      if(mStartMode == GPS_COLD_START){
          extra.putBoolean("ephemeris", true);
          extra.putBoolean("position", true);
          extra.putBoolean("time", true);
          extra.putBoolean("iono", true);
          extra.putBoolean("utc", true);
          extra.putBoolean("health", true);
          extra.putBoolean("svdir", true);
          extra.putBoolean("svsteer", true);
          extra.putBoolean("sadata", true);
          extra.putBoolean("rti", true);
          extra.putBoolean("celldb-info", true);
      }
      else if(mStartMode == GPS_WARM_START)
      {
          extra.putBoolean("ephemeris", true);
          extra.putBoolean("time", true);
      }

        locationMgr.sendExtraCommand(LocationManager.GPS_PROVIDER, "delete_aiding_data", extra);
    }

Now if you call requestLocationUpdates() the GPS cache will be empty.

Upvotes: 2

Related Questions