I am calling a webservice from an AsyncTask. It works fine but i'm trying to test it when i've turned the phone's mobile network off. This is to replicate the user having no signal.
here's the code.
@Override
protected Void doInBackground(String... params) {
try {
Log.e(TAG, "inside doInBackground");
rotaArray = nfcscannerapplication.loginWebservice.getRota(params[0], params[1]);
} catch (Exception e) {
Log.e(TAG, "there's a problem");
e.printStackTrace();
}
return null;
}
The log statement is never logged out to logcat enev though a java.net.ConnectionException is thrown. How can i deal with potentially not having a network signal and gracefully exit the app or even better call the activities oncreate again?