Android: DownloadFile From Server Using Retrofit — Part 2: Beware with Large Files: Use @Streaming!

If you’re downloading a large file, Retrofit would try to move the entire file into memory. In order to avoid that, we’ve to add a special annotation to the request declaration:

@Streaming
@GET
Call<ResponseBody> downloadFileWithDynamicUrlAsync(@Url String fileUrl);

--

--

--

🎓 A true Software Engineer aspires to build a strong community and help other people grow up.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Android 13 and Text Rendering Algorithms

Flutter: Drop Shadow Effect for Image.

Android: MVP vs MVVM Key differences

Jetpack Compose Interop Part 1: Using Traditional Views and Layouts in Compose with AndroidView

Build Release Apk In Flutter

Exploring Android Vibrator API

How Hilt works for Android

How to Develop Games with Game Service

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Hau NGUYEN

Hau NGUYEN

🎓 A true Software Engineer aspires to build a strong community and help other people grow up.

More from Medium

Tinkering around Gradle plugin basics

Google I/O 22: Android Keynote

Watch files on folder with Kotlin

Making a Dynamic RecyclerView Adapter that works like magic