1
I send a request to the server but it takes to receive the result, I realized that the Asynctask that sends the location to the server every 1 second is getting in the way.
I realized this after I changed it to 3 seconds, where I sent a new request that took 1 to 3 seconds.
The code where Asynctask is used is below:
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
//Atualizar GeoLocalização
localizacao.setUsuario(motoqueiro.getId());
localizacao.setLatitude(location.getLatitude());
localizacao.setLongitude(location.getLongitude());
new GeoUpdateAsynctask().execute(localizacao);
handler.postDelayed(this, APP_REFRESH_TIME * 1000);
}
}, APP_REFRESH_TIME * 1000);
}
I would like to suggest some other method that you can use in this case, since I use several Asynctask in parallel.
If I understand your explanation correctly, the problem is on the server side, or not?.
– ramaral
No brother, the problem why the treds should be queuing up, and when I send a request to the server, I only get it when the treads finish running.
– Rubens Ventura