Guest User

Untitled

a guest
Jun 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. @Override
  2. public void onPause()
  3. {
  4. super.onPause();
  5. // Save batterylife by not aquiring location data when paused
  6. LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
  7. locationManager.removeUpdates(mLocationListener);
  8. }
  9.  
  10. @Override
  11. public void onResume()
  12. {
  13. super.onResume();
  14.  
  15. // Resume getting location updates
  16. LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
  17. locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, mLocationListener);
  18. }
Add Comment
Please, Sign In to add comment