mirror of
https://gitee.com/shuto/cordova-plugin-network-information.git
synced 2025-01-31 18:47:21 +08:00
CB-6907: android: Don't crash on startup if no networks available
This commit is contained in:
parent
f4ffab9c71
commit
a5e9631258
@ -189,6 +189,7 @@ public class NetworkManager extends CordovaPlugin {
|
|||||||
*/
|
*/
|
||||||
private JSONObject getConnectionInfo(NetworkInfo info) {
|
private JSONObject getConnectionInfo(NetworkInfo info) {
|
||||||
String type = TYPE_NONE;
|
String type = TYPE_NONE;
|
||||||
|
String extraInfo = "";
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
// If we are not connected to any network set type to none
|
// If we are not connected to any network set type to none
|
||||||
if (!info.isConnected()) {
|
if (!info.isConnected()) {
|
||||||
@ -197,8 +198,8 @@ public class NetworkManager extends CordovaPlugin {
|
|||||||
else {
|
else {
|
||||||
type = getType(info);
|
type = getType(info);
|
||||||
}
|
}
|
||||||
|
extraInfo = info.getExtraInfo();
|
||||||
}
|
}
|
||||||
String extraInfo = info.getExtraInfo();
|
|
||||||
|
|
||||||
Log.d("CordovaNetworkManager", "Connection Type: " + type);
|
Log.d("CordovaNetworkManager", "Connection Type: " + type);
|
||||||
Log.d("CordovaNetworkManager", "Connection Extra Info: " + extraInfo);
|
Log.d("CordovaNetworkManager", "Connection Extra Info: " + extraInfo);
|
||||||
|
Loading…
Reference in New Issue
Block a user