title: Android: Mock Location changes back to Original after a few seconds
body: <p>I have an android app in which I need the user to mock their current location.
  Below is the code I use which let's user press the green button to start mocking their location.</p>
  
  <p>Below code starts faking the location when "green button" is pressed.</p>
  
  <pre><code>greenButton.setOnClickListener(new View.OnClickListener(){
       @Override
       public void onClick(View view) { 
          LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
          lm.addTestProvider(LocationManager.GPS_PROVIDER,
                  "requiresNetwork" == "",
                  "requiresSatellite" == "",
                  "requiresCell" == "",
                  "hasMonetaryCost" == "",
                  "supportsAltitude" == "",
                  "supportsSpeed" == "",
                  "supportsBearing" == "",
                  Criteria.POWER_LOW,
                  Criteria.ACCURACY_FINE);
  
          Location newLocation = new Location(LocationManager.GPS_PROVIDER);
          newLocation.setLatitude(fakeLocation.getLatitude());
          newLocation.setLongitude(fakeLocation.getLongitude());
          newLocation.setAccuracy(fakeLocation.getAccuracy());
          newLocation.setTime(System.currentTimeMillis());
          newLocation.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
          lm.setTestProviderEnabled(LocationManager.GPS_PROVIDER, true);
          lm.setTestProviderStatus(LocationManager.GPS_PROVIDER,
                  LocationProvider.AVAILABLE,
                  null, System.currentTimeMillis());
          lm.setTestProviderLocation(LocationManager.GPS_PROVIDER, newLocation);
        }
   });
  </code></pre>
  
  <p>When I place a marker on the map and press the green button. Location mocking starts. That "fake location" becomes my current location. </p>
  
  <p>But after like 10-20 seconds, the mocking just ends. My "real location" becomes my current location. I have seen a lot of examples online and they use the same code I am using to mock the location. I don't know why this happens with my app. Any help would be appreciated.</p>