Skip to content

Commit

Permalink
Use the App context instead of the activity to prevent leak
Browse files Browse the repository at this point in the history
  • Loading branch information
ligi committed Oct 23, 2016
1 parent f056476 commit d9190a3
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ abstract class ConnectivityAwareCondition implements SnackCondition {
protected void init(final Context context) {

if (context.checkCallingOrSelfPermission(Manifest.permission.ACCESS_NETWORK_STATE) == PackageManager.PERMISSION_GRANTED) {
connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
connectivityManager = (ConnectivityManager) context.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);

activeNetwork = connectivityManager.getActiveNetworkInfo();
}
Expand Down

0 comments on commit d9190a3

Please sign in to comment.