title: location listener not working
body: <p>I have used the code to to play mp3 sound after 30 secs interval and 30 mts distance but it does not play after <strong>the mobile is sleeping</strong> and I have travelled well over 5 miles.</p>
  
  <p>HOW to make the code above work ? 
  Please Help. </p>
  
  <p>Thanks in Advance.</p>
  
  <p>I had an addon query : Does onLocationChanged method know my last location? In other words if I have executed this statement :</p>
  
  <pre><code>locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 30, 30000, new MyLocationListener());
  </code></pre>
  
  <p><strong>Will mp3 file execute every 30 secs interval and 30 mts distance by itself?</strong> OR will I have to execute the statement within ScheduledExecutorService like this:</p>
  
  <pre><code>ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
          executor.scheduleWithFixedDelay(new Runnable(){
  
              public void run() {
  
  locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 30, 30000, new MyLocationListener());
  
  
  
              }
  
          }, 0, 600, TimeUnit.SECONDS);
  </code></pre>
  
  <p><strong>Total Code :</strong></p>
  
  <pre><code>locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 30, 30000, new MyLocationListener());
  
  
  
  
  
  private class MyLocationListener implements LocationListener {
  
  
      public void onLocationChanged(Location location) {
  
  
          ///Audio file which plays everytime the above condition is met 
          mp3.start();
  
  
  
          );
  
          Toast.makeText(AndroidGPSSampleActivity.this, message, Toast.LENGTH_LONG).show();
      }
  
      public void onStatusChanged(String s, int i, Bundle b) {
  
          Toast.makeText(AndroidGPSSampleActivity.this, "Provider status changed",Toast.LENGTH_LONG).show();
      }
  
      public void onProviderDisabled(String s) {
  
          Toast.makeText(AndroidGPSSampleActivity.this,"Provider disabled by the user. GPS turned off",Toast.LENGTH_LONG).show();
      }
  
      public void onProviderEnabled(String s) {
          System.out.println("==onProviderEnabled=" + s);
          Toast.makeText(AndroidGPSSampleActivity.this, "Provider enabled by the user. GPS turned on",Toast.LENGTH_LONG).show();
      }
  
  
  }
  </code></pre>