I have a thread that sends GPS coordinates to a database every six seconds and I have a check that verifies that the user is within a defined area. If the user is not within
new Handler().post(new Runnable{ public void run(){ //create your AlertDialog here.. } });
see more here