From ba689273a6e38ab58512c6caf4f3d1027473003f Mon Sep 17 00:00:00 2001 From: drabux Date: Fri, 6 Oct 2017 01:49:19 +0200 Subject: [PATCH] fix wifi service mem leak The WIFI_SERVICE must be looked up on the Application context or memory will leak on devices < Android N. Try changing activity to activity.getApplicationContext() [WifiManagerLeak] --- .../de/danoeh/antennapod/preferences/PreferenceController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java index 7777af450..2ca7dd029 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java @@ -759,7 +759,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc clearAutodownloadSelectedNetworsPreference(); } // get configured networks - WifiManager wifiservice = (WifiManager) activity.getSystemService(Context.WIFI_SERVICE); + WifiManager wifiservice = (WifiManager) activity.getApplicationContext().getSystemService(Context.WIFI_SERVICE); List networks = wifiservice.getConfiguredNetworks(); if (networks != null) {