03 September 2024
In Android 14 we introduced user-initiated data transfer jobs, or UIDT. You can use the new API setUserInitiated in JobScheduler to specify that the job is a user-initiated data transfer job. This API is helpful for use cases that require long-duration (>10 minutes), user-initiated transfer of data over network. UIDT is also an alternative API to using a dataSync foreground service, which has new timeout behavior for apps that target Android 15.
UIDT is intended to support user initiated use cases such as downloading files from a remote server, uploading files to a remote server or transferring data between two devices via Wi-Fi transport. Since the release of Android 14, the new API has been adopted by a growing number of Android apps running on hundreds of millions of user devices.
The Android team’s extensive analysis found gaps in foreground services and WorkManager for long duration, user initiated data transfers. Although WorkManager could support retries and constraints, it could not support long duration work which are often necessary for data transfer operations. Developers also found it challenging to use foreground service, which did not provide an ideal user experience during interruption of network connectivity.
JobScheduler’s user initiated data transfer API helps solve for these gaps by offering developers the following benefits:
If you’re looking to do short or interruptible background work, WorkManager is still the recommended solution. Check out data transfer background task options to learn more.
Google Maps decided to use UIDT for their offline maps download use case. This use case ensures that users are able to download offline maps so they have map data even when they lose network connectivity.
Google Maps decided to adopt UIDT to ensure that the download service works with the latest Android releases and continues to be reliable and efficient.
“We implemented several features and optimizations, such as resumable downloads so that if a user's internet connection is interrupted or they exit the app before the download is complete, the download resumes from where it left off when the user returns to the app or their connection is restored.” - Emma Li, Software Engineer at Google
The UIDT is triggered when a user decides to download a map region to have that data offline. When a user hits download, the UIDT is triggered immediately and processing of the region begins as soon as possible.
Google Maps rolled out the project using experiment flags to understand metrics impact after each ramp stage.
“We successfully launched UIDT on Android 14 in early 2024 migrating from our foreground service implementation. After a retroactive analysis on Android 14 vs Android 13 implementation, we now see a 10%+ improvement in download failure rate of offline downloads!” - Matthew Valgenti, Software Engineer at Google
In order to adopt user initiated data transfer, you will need to integrate with the JobScheduler platform API and gate the change to Android 14 or higher.
Check out the following developer documentation to get started with user initiated data transfer:
This blog post is part of our series: Spotlight Week on Android 15, where we provide resources — blog posts, videos, sample code, and more — all designed to help you prepare your apps and take advantage of the latest features in Android 15. You can read more in the overview of Spotlight Week: Android 15, which will be updated throughout the week.