How I can possibly check the network signal strength before executing the AsyncTask.
For example If user's Phone has no Internet or Unstable Connection A toast should popup notifying the user that he/she has a weak connection. And if the user's phone has a strong or stable connection the asynctask will be executed.
PS.
what I am talking about is like this kind of asynctask
class AttemptGetData extends AsyncTask<String, String, String>{
String ID = att_id.toString();
String Stud_id = stud_no.toString();
String remarks = RadioAttBtn.getText().toString();
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(AddStudentAttendance.this);
pDialog.setMessage("In Progress...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
@Override
protected String doInBackground(String... params) {
List<NameValuePair> mList = new ArrayList<NameValuePair>();
mList.add(new BasicNameValuePair("att_list_id", ID));
mList.add(new BasicNameValuePair("student_no", Stud_id));
mList.add(new BasicNameValuePair("remark", remarks));
Log.d("starting", "fetch");
JSONObject json = jsonParser.makeHttpRequest(url1, "POST", mList);
try {
verify = json.getString("Message");
return verify;
}catch (JSONException e){
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
pDialog.dismiss();
if (s != null){
Toast.makeText(getApplicationContext(), verify, Toast.LENGTH_LONG).show();
}
}
}