Android Developers Blog
The latest Android and Google Play news for app and game developers.
🔍
Platform Android Studio Google Play Jetpack Kotlin Docs News

03 September 2024

Google Maps improved download reliability by 10% using user initiated data transfer API


Link copied to clipboard
Posted by Alice Yuan – Developer Relations Engineer, in collaboration with Software Engineers – Matthew Valgenti and Emma Li – at Google

What is user initiated data transfer?

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.


What are the benefits if I adopt user-initiated data transfer?

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:

    • Long duration, immediate background work execution that is not impacted by existing job quotas based on app standby buckets.
    • Helps improve consistency in API behavior across all devices, and the behavior is enforced through Compatibility Test Suite (CTS).
    • Improved reliability of data transfer compared to using a foreground service as indicated by Google Maps own benchmarks.
    • Support for execution when certain constraints are met, such as running only on Wi-Fi or only when the device is charging.
    • Gracefully manages job timeouts and retries.
    • Reduced memory usage and reduced notification clutter when the app is waiting for constraints to be met.

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.

“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

Google Maps successfully launched UIDT and saw improvement in download reliability!

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.

What was Google Maps’ main motivation for adopting UIDT?

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

What is the trigger point to start UIDT in Google Maps?

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.

What were Google Maps’ adoption results?

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

How do I get started implementing user initiated data transfer API?

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.