mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 04:54:04 -08:00
Fixed Wifi mangager memory leak on devices < N (#811)
AndroidStudio reported the error: Error: The WIFI_SERVICE must be looked up on the Application context or memory will leak on devices < Android N. Try changing to .getApplicationContext() [WifiManagerLeak]
This commit is contained in:
parent
f4266e0a51
commit
da4e333d66
|
@ -61,7 +61,7 @@ public final class WifiResultHandler extends ResultHandler {
|
|||
public void handleButtonPress(int index) {
|
||||
if (index == 0) {
|
||||
WifiParsedResult wifiResult = (WifiParsedResult) getResult();
|
||||
WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
|
||||
WifiManager wifiManager = (WifiManager) getActivity().getApplicationContext().getSystemService(Context.WIFI_SERVICE);
|
||||
if (wifiManager == null) {
|
||||
Log.w(TAG, "No WifiManager available from device");
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue