Resuming an Interrupted APK Download: HTTP Range, Mobile Dropouts, and Verification
An APK download that dies at 80% is a server-and-client negotiation problem, not bad luck. Learn how HTTP Range and If-Range work, why Android kills downloads, how to resume with curl -C -, and how to verify a stitched file before installing.
You are 150 MB into a 200 MB APK. You take a call, switch back, and the progress bar is at zero. You restart it, and it dies at the same byte again.
Resuming is not a client-side feature you can switch on. It is a negotiation: the server must support byte ranges, and the client must actually use them. If either side is missing, the only path forward is starting over — which is fine, as long as you know that's what you're doing.
The mechanism: HTTP Range
A normal download says "send me everything." A resumed download says "start at byte N":
GET /app-release.apk HTTP/1.1
Host: example.com
Range: bytes=157286400-A server that supports it answers:
HTTP/1.1 206 Partial Content
Content-Range: bytes 157286400-209715199/209715200
Content-Length: 52428800Three conditions must all hold:
- Status is
206, not200. A 200 means "I ignored your range and I'm sending the whole file" — which is correct if the file changed underneath you. Content-Rangeis present and its total size matches what you already have on disk.- The file is the same version. Downloaders should send
If-Rangewith the validator they saw originally:
If-Range: "a3f5c9e2-19d8b1c"
Range: bytes=157286400-If the build was replaced in the meantime, the server correctly falls back to a full 200. Accept that. Splicing a fresh header onto an old tail produces a corrupt APK — and a corrupt APK that still installs is worse than one that doesn't.
Test any URL in one command
curl -sI -H "Range: bytes=0-1023" https://example.com/app-release.apk | head -5206 Partial Content means resumable. 200 OK with the full Content-Length means it is not; use a segmented downloader or switch networks and accept a full restart.
Why Android kills large downloads
APKs are big and slow, which puts them directly on top of several Android defaults:
| Cause | Symptom | Fix |
|---|---|---|
| Process frozen in background | Progress resets after a call | Keep downloader foregrounded, allow background activity |
| Battery optimisation cuts network | Stalls when screen is off | Set downloader to "Unrestricted" |
| Wi-Fi ↔ cellular handoff | Connection resets mid-transfer | Disable "switch to mobile data" assistants |
| Proxy or VPN dropout | Stalls at the same percentage | Avoid sharded proxies; use a stable route |
| Low storage | Download completes, write fails | Free 2× the APK size |
| Server rate limiting | Fast start, slow tail, timeout | Wait minutes, don't hammer retry |
The most diagnostic symptom is "retries die at the same byte." That means everything before the breakpoint is reachable and the problem is near the tail — usually an edge-cache miss on that slice, or an aggressive upstream timeout. Change the source; more retries won't help.
Where to grant background permission
- Stock / near-AOSP: Settings → Apps → Downloader → Battery → Unrestricted
- MIUI / HyperOS: Apps → Manage apps → Downloader → Battery saver → No restrictions
- ColorOS / OriginOS: Battery → App battery management → Allow background activity
- One UI: Battery → Background usage limits → remove from "Sleeping apps"
Then test properly: lock the phone for ten minutes and check whether the progress moved.
Three ways to actually resume
1. Use a downloader that honours Range
ADM, IDM-class apps, and most built-in browser downloaders all support it. The only test that matters: after an interruption, does "Retry" continue from the breakpoint or restart at 0%?
- Download from a direct file URL, not a redirect page or a signed link with a short-lived token. Expired tokens turn a resume into a 403.
- Never clear browser cache or the download task while a transfer is incomplete.
- After reconnecting, wait 10–30 seconds before retrying so you don't hit a rate limiter.
2. Refresh and restart the task (for expired links)
When the URL itself has expired, "Resume" is meaningless — the task points at a dead address. Go back to the page, click download again, and delete the stale task. Delete-then-redownload is cleaner than trying to revive a task with a replaced URL.
3. Resumable download on a computer, then copy to the phone
# -C - resumes from the current end of file; safe to run repeatedly
curl -L -C - -o app-release.apk "https://example.com/app-release.apk"
# wget equivalent
wget -c "https://example.com/app-release.apk"curl -C - is idempotent: after any disconnect, run it again and it computes the offset itself. Keep -L, or a 302 will end the transfer.
When a single connection is unstable but the server supports ranges, fetch slices in parallel:
SIZE=$(curl -sI "https://example.com/app-release.apk" | awk '/Content-Length/{print $2}' | tr -d '\r')
for i in $(seq 0 7); do
START=$(( SIZE / 8 * i ))
END=$(( SIZE / 8 * (i+1) - 1 ))
[ $i -eq 7 ] && END=$(( SIZE - 1 ))
curl -s -r ${START}-${END} -o part.$i "https://example.com/app-release.apk" &
done
wait
cat part.* > app-release.apkSegmented downloads are where corruption actually happens. Verify before installing.
Verify the stitched file — always
- Size matches the advertised byte count exactly. A few hundred bytes short means the last chunk never landed.
- Hash, if the site publishes SHA-256:
shasum -a 256 app-release.apk # macOS
sha256sum app-release.apk # Linux- Archive integrity:
unzip -t app-release.apkvalidates the ZIP central directory. An APK is a ZIP; a broken directory is exactly what "There was a problem parsing the package" reports.
If any check fails, the only correct action is a full re-download. Particularly for banking, payment, and messaging apps, a single bad byte from a spliced file is enough to make the package untrustworthy.
Decision shortcut
- Server answers
206→ use a resumable downloader; the breakpoint reconnects on its own. - Server answers
200→ resume is impossible; loopcurl -C -or segment-and-verify. - Dies at the same percentage every time → change source.
- Completes but won't install → run
unzip -tand the hash before assuming the build is broken.
For failures that happen before the transfer starts — 403, 404, expired signed URLs — see APK download 403, 404, and mid-transfer failures, or grab packages directly from the gptoapk APK downloader.