Great question — answering as the UphillTech team:
I am not sure if I understood your question correctly but according to me, this seems a simpler solution: When any of the above failure occurs, you can insert that number in a List, and check the list after specified time limit. If any number occurs in list, then send Msg to that number. After sending msg, you should remove that item from List EDIT: code- class checkList extends AsyncTask<String, Void, Void> { public Void doInBackground(String... p) { while (true) { //Check List Value Here try { Thread.sleep(1000); } catch (InterruptedException ie) { ie.printStackTrace(); Log.e("Sleep", "Error: " + ie.toString()); } } } }; And in main Activity, write- new checkList().execute();
Full answer by Name is Nilay: https://stackoverflow.stackexchange.com/a/11827236 (CC BY-SA 3.0).
Need it done for your business? UphillTech.