I'm getting an error in ConnectivityManager
when loading the app. I've used it a lot but this is the first time I've encounter it.
it says null but I don't have an idea what this error cause.
this is my code:
final ConnectivityManager connMgr = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
final android.net.NetworkInfo wifi = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
final android.net.NetworkInfo mobile = connMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if (wifi.isConnected()) {
baseUrl = URL1;
} else if (mobile.isConnected()) {
baseUrl = URL2;
}
and this is the error on Logcat