An Android app starts uploading a photo. The server saves it. Before the app receives the response, the connection drops during a VPN reconnect.
WorkManager runs the upload again. Now the server has two copies.
From the worker’s perspective, the first attempt ended with a network error. From the server’s perspective, it succeeded. The app has to handle the possibility that both are true.
The fix starts with one rule: give each logical upload a stable ID, reuse it on every attempt, and have the server enforce uniqueness.
What WorkManager can tell you
A NetworkType.CONNECTED constraint lets WorkManager schedule the job when Android reports connectivity that meets the constraint. If the constraint stops being met while the job runs, WorkManager can stop the worker and run it later. Your own Result.retry() can also schedule another attempt, with backoff.
Neither event tells you what the server did with the previous request.…