Fixing CB-1521 - NullPointerException on Default Jellybean Emulator

This commit is contained in:
Joe Bowser 2012-09-21 11:48:33 -07:00
parent 7eb12110d1
commit 2a9582ebb1

View File

@ -99,7 +99,9 @@ public class NetworkManager extends Plugin {
@SuppressWarnings("deprecation")
@Override
public void onReceive(Context context, Intent intent) {
updateConnectionInfo((NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO));
// (The null check is for the ARM Emulator, please use Intel Emulator for better results)
if(webView != null)
updateConnectionInfo((NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO));
}
};
cordova.getActivity().registerReceiver(this.receiver, intentFilter);
@ -198,10 +200,9 @@ public class NetworkManager extends Plugin {
result.setKeepCallback(true);
this.success(result, this.connectionCallbackId);
// Send to all plugins
webView.postMessage("networkconnection", type);
}
/**
* Determine the type of connection
*