File Download Implementation in Mobile Apps

File Download Implementation in Mobile Apps File download is more than just an API call. Distinguish between two fundamentally different scenarios: fast retrieval of small resources (images, documents up to 10 MB) directly in memory, and downloading large files (videos, archives up to 10 GB) w

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
File Download Implementation in Mobile Apps
Simple
from 1 day to 3 days

Our competencies:

Frequently Asked Questions

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    895
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    782
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1216
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1079
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    1002
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    597

File Download Implementation

in Mobile Apps

File download is more than just an API call. Distinguish between two fundamentally different scenarios: fast retrieval of small resources (images, documents up to 10 MB) directly in memory, and downloading large files (videos, archives up to 10 GB) with progress indication and resume capability. In 80% of apps, file download functionality is necessary. Mixing these approaches is a common mistake that leads to OOM crashes or a hanging indicator with no feedback. We've implemented this logic in 50+ projects over 10 years on the market—we guarantee stable operation even on low-end devices.

How to Avoid OOM When Downloading Large Files?

The main cause of OOM is attempting to load the entire file into memory. For files >10 MB always use streaming write to disk. On Android—OkHttp with ResponseBody.byteStream() and writing to a file via FileOutputStream in a background coroutine. On iOS—URLSession.downloadTask saves to a temporary file automatically. For Flutter—dio with receiveTimeout option and writing via File. In practice, OOM occurs when downloading files >50 MB without buffering.

Why Progress Bar May Not Work?

The progress bar shows correct percentages only if the server returns the Content-Length header. If missing, the indicator will just spin without numeric value. In such cases you can show an indeterminate progress (activity indicator) or download the file in chunks via Range requests if the server supports resume. Over 30% of servers do not send Content-Length, so test against a real backend.

Mobile File Download by Platform

Compare approaches on three main platforms:

Platform Small Files Large Files Resume Background
Android OkHttp/Retrofit DownloadManager or WorkManager DownloadManager (partial) DownloadManager / WorkManager
iOS URLSession.dataTask URLSession.downloadTask (background) Manual via URLSession URLSession background configuration
Flutter Dio flutter_downloader Dio (manual) flutter_downloader

Android. For in-memory download—OkHttp or Retrofit with ResponseBody.byteStream(), write data to file in an IO coroutine. For large files, system DownloadManager with notification in status bar—user sees progress even after leaving the app. DownloadManager is 2x more efficient than a custom download service for large files. Alternative—WorkManager with custom Worker if more control is needed.

Saving to Downloads folder on Android 10+: use MediaStore API for public files, getExternalFilesDir() for private ones. Attempting to write directly to /sdcard/Download/ without MediaStore on modern versions will throw SecurityException.

Android DownloadManager code example
val request = DownloadManager.Request(Uri.parse(url)) .setTitle(fileName) .setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName) .setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED) val downloadId = downloadManager.enqueue(request) 

iOS. URLSession.downloadTask saves to a temporary file, after which you need to move it to FileManager.default.urls(for: .documentDirectory). For background downloads—URLSessionConfiguration.background(withIdentifier:) with delegate URLSessionDownloadDelegate. Without a background session, download stops when the app goes to background.

let config = URLSessionConfiguration.background(withIdentifier: "com.app.download") let session = URLSession(configuration: config, delegate: self, delegateQueue: nil) let task = session.downloadTask(with: URL(string: url)!) task.resume() 

Implement urlSession(_:downloadTask:didFinishDownloadingTo:) to move the file and urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:) for progress.

Flutter: package dio with onReceiveProgress, saving via path_provider. For background download—flutter_downloader, which wraps native DownloadManager (Android) and URLSession (iOS).

Details Often Overlooked

A file may download partially due to disconnection. Resumable download via Range header (Range: bytes=1048576-) works only if the server returns Accept-Ranges: bytes and Content-Range. If server does not support it, download starts over. Before implementing resume, test backend behavior—this can save up to 30% download time on unstable connections. On average, 15% of download attempts fail on mobile networks, so proper error handling is critical.

Also important to show real progress, not deterministic. If Content-Length header is missing, progress bar will spin without percentages. In that case, better use an indeterminate indicator.

Work Process

  1. Requirements analysis: what files, max size, need resume and background download.
  2. Stack selection: DownloadManager or URLSession background with configuration.
  3. Design: storage scheme, error handling, progress dialog.
  4. Implementation: coding with platform specifics (ProGuard/R8, App Transport Security).
  5. Testing: on real devices with varying network speed and interruptions.
  6. Deployment: publish to App Store and Google Play with crash log debugging.

Typical Download Errors

  • Downloading on main thread—guaranteed ANR on Android.
  • Ignoring Content-Type—file may be saved without extension.
  • Not cleaning temporary files—Documents & Data grows.
  • Not releasing URLSession after background task on iOS—memory leak.

What's Included in the Work

We select the approach for the task (in-memory vs file, foreground vs background), implement progress, saving to the desired directory, network error handling, and temporary file cleanup. We handle download end-to-end with all platform specifics—from App Store Review Guidelines to ProGuard rules.

Timeline: 1–3 days depending on requirements for resume and background behavior. Our basic implementation starts at $500, with complex projects averaging $850. This saves you up to 40% compared to in-house development. Contact us to evaluate your project—write to us, we'll propose an optimal solution considering your stack.

Documentation: URLSession Programming Guide, DownloadManager Reference