In my main activity, I'm doing that every time there is internet send the sqlite data to the server of mysql clear only those that have not synchronized all that I have solved but the problem is that I want my application to close it already be removing it with the adm. of tasks this continues working and verifying if there is internet.
Thread timerTread = new Thread(){
public void run(){
try{
sleep(2000);
}
catch (InterruptedException e){
e.printStackTrace();
} finally {
//<<<<<<<<<<<<<<<<<<<<<<<<<< Aqui el envio de mi información
}
}
};
timerTread.start();
I do not know if I'm doing the correct operation for sending information, I want it to be sent, for example, every 2000ms, is this the correct way? How then do I prevent my app from closing when performing this type of operations?