0
Hello guys I have the following problem I have an application that uses Volley to get certain data json through api up to there all right it works properly but the problem is Volley cache that does not reset until the application is closed completely, example as long as the cel is not shut down or the application itself is closed by the task manager the json data will not update in what way I can do so that in example every 30 minutes the obtained data is updated.
My Code:
JsonArrayRequest arrayreq = new JsonArrayRequest(JsonURL, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
try {
JSONObject obj = response.getJSONObject(0);
String valor = obj.getString("valor");
String data = obj.getString("data");
results.setText("Vale R$: " + valor );
datav.setText("Última atualização: " + data);
} catch (JSONException e) {
e.printStackTrace();
}}},
new Response.ErrorListener() {
@Override
// Handles errors that occur due to Volley
public void onErrorResponse(VolleyError error) {
results.setText("Erro ao obter dados");
Log.e("Volley", "Error");
}
}
);
requestQueue.add(arrayreq);