I'm making an application on android. Inside it I have a Google maps object from which I get the latitude and longitude respectively. The problem is that I need to send this data every 3 seconds to a server through the Web Service. However, I can only execute the "execute" method of the asynctask class once. I tried looping in the doInBackground method, but only sending data once. How could I keep sending the data constantly? This is the loop that I made inside the doInBackground
HttpGet get = new HttpGet( servicio + "Longitud="+ String.valueOf(longitud) +"&Latitud="+ String.valueOf(latitud));
get.setHeader("Content-type","application/json");
try{
while (true){
response = httpClient.execute(get);
respuesta = EntityUtils.toString(response.getEntity());
respJSON = new JSONObject(respuesta);
estado = respJSON.getString("estado");
Log.i("ServicioRest","Latitud--> " + String.valueOf(latitud) + " Longitud--> " + String.valueOf(longitud));
Thread.sleep(3000);
}