iwanabeguru
Lurker
Hi all
I'm new to here and i hope i can get some help. I not searched the forums for similar topics cause i do not have much time, so please forgive me if this question asked before.
So, I want to check that the network connection is alive on the phone from program but when i try to run this code
I get the message "Sorry 'Appname' is stopped unexpectedly. Try again"
Can someone help me with this?
EDIT1
I might have to search the solution elsewhere, i added permissions for network, run the application and got the same error but when i tried to start it from the menu it said application not installed.
Thank you
iwanabeguru
I'm new to here and i hope i can get some help. I not searched the forums for similar topics cause i do not have much time, so please forgive me if this question asked before.
So, I want to check that the network connection is alive on the phone from program but when i try to run this code
Code:
private boolean isOnline() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnectedOrConnecting()) {
return true;
}
return false;
}
I get the message "Sorry 'Appname' is stopped unexpectedly. Try again"
Can someone help me with this?
EDIT1
I might have to search the solution elsewhere, i added permissions for network, run the application and got the same error but when i tried to start it from the menu it said application not installed.
Thank you
iwanabeguru