mirror of https://github.com/M66B/NetGuard.git
Fixed crash
This commit is contained in:
parent
b3fc422176
commit
62ee4681b0
|
@ -176,13 +176,14 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
|
||||||
sb.append(String.format("Interactive %B\r\n", Util.isInteractive(this)));
|
sb.append(String.format("Interactive %B\r\n", Util.isInteractive(this)));
|
||||||
for (Network network : cm.getAllNetworks()) {
|
for (Network network : cm.getAllNetworks()) {
|
||||||
NetworkInfo ni = cm.getNetworkInfo(network);
|
NetworkInfo ni = cm.getNetworkInfo(network);
|
||||||
sb.append(ni.getTypeName())
|
if (ni != null)
|
||||||
.append("/")
|
sb.append(ni.getTypeName())
|
||||||
.append(ni.getSubtypeName())
|
.append("/")
|
||||||
.append(" ")
|
.append(ni.getSubtypeName())
|
||||||
.append(ni.getDetailedState())
|
.append(" ")
|
||||||
.append(ni.isRoaming() ? " ROAMING" : "")
|
.append(ni.getDetailedState())
|
||||||
.append("\r\n");
|
.append(ni.isRoaming() ? " ROAMING" : "")
|
||||||
|
.append("\r\n");
|
||||||
}
|
}
|
||||||
sb.append(String.format("WiFi %B\r\n", Util.isWifiActive(this)));
|
sb.append(String.format("WiFi %B\r\n", Util.isWifiActive(this)));
|
||||||
sb.append(String.format("Metered %B\r\n", Util.isMeteredNetwork(this)));
|
sb.append(String.format("Metered %B\r\n", Util.isMeteredNetwork(this)));
|
||||||
|
|
|
@ -176,14 +176,15 @@ public class Util {
|
||||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
for (Network network : cm.getAllNetworks()) {
|
for (Network network : cm.getAllNetworks()) {
|
||||||
NetworkInfo ni = cm.getNetworkInfo(network);
|
NetworkInfo ni = cm.getNetworkInfo(network);
|
||||||
sb.append("Network: ")
|
if (ni != null)
|
||||||
.append(ni.getTypeName())
|
sb.append("Network: ")
|
||||||
.append("/")
|
.append(ni.getTypeName())
|
||||||
.append(ni.getSubtypeName())
|
.append("/")
|
||||||
.append(" ")
|
.append(ni.getSubtypeName())
|
||||||
.append(ni.getDetailedState())
|
.append(" ")
|
||||||
.append(ni.isRoaming() ? " R" : "")
|
.append(ni.getDetailedState())
|
||||||
.append("\r\n");
|
.append(ni.isRoaming() ? " R" : "")
|
||||||
|
.append("\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
|
Loading…
Reference in New Issue