Last active
January 11, 2020 12:55
-
-
Save shikto1/53e2f33ff841feee4d03f22bde353ede to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GoodActivity extends Activity implements LocationListener { | |
private LocationManager mLocManager; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_leaks); | |
mLocManager = (LocationManager) getSystemService(LOCATION_SERVICE); | |
mLocManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, | |
TimeUnit.MINUTES.toMillis(5), 100, this); | |
} | |
@Override | |
protected void onDestroy() { | |
if(mLocManager != null){ | |
mLocManager.removeUpdates(this); | |
} | |
super.onDestroy(); | |
} | |
// Listener implementation omitted | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment