0

My app sends data to a server every few minutes. It works fine as long as I'm online. When I'm offline in between, it seems like the stringRequests are temporarily stored in the requestQueue and fired all together as soon as I establish the internet connection.

To avoid adding duplicates to the requestQueue, I'm looking for something like the following pseudo-code:

if (!requestQueue.isRequestInQueue(stringRequest)) {
    requestQueue.add(stringRequest);
}

I'd like to avoid using requestQueue.cancelAll().

Any ideas how to avoid duplicates in a RequestQueue? Thanks in advance!

Mr. B.
  • 8,041
  • 14
  • 67
  • 117

1 Answers1

0

After trying different solutions, I chose requestQueue.cancelAll() and it works as expected.

For further information, check the docs.

Mr. B.
  • 8,041
  • 14
  • 67
  • 117