Android API Client
Android (Kotlin and Java) integration handles uploads and file operations by wrapping Uploadcare Upload API and REST API. This comprehensive API client lets you use most of the Uploadcare features from within your Android app. It also includes a native uploading widget.
Features
Concise and easy-to-use library without extra resources and drawables.
Uploading (Upload API):
- Upload files from a file, byte array, URL, URI and cloud sources (up to 5 TB)
- Multipart uploading for large files
- Track, pause and resume multipart uploads
- Bulk file uploading
- Uploading network to speed uploading jobs (like CDN)
File uploading widget:
- Upload files from a local disk, camera, and cloud sources
- Track upload progress and cancel uploads
- Background uploading
- Material design Uploader appearance customization and styles
File management (REST API):
- Get file info and perform various operations (store/delete/copy) with them
- Work with groups of files
- Get info about account project
- Manage webhooks
- Convert documents
- Encode and transform videos
- Paginated resource fetching
- Synchronous and asynchronous operation modes
Image processing (URL API):
- CDN path builder
- Compression
- Geometry
- Colors
- Definition
- Image and text overlays
- Rotations
- Recognition
- File info
- Proxy (fetch)
Security:
- Secure authentication
- Secure uploads (signed uploads)
- Secure delivery (signed URLs)
Installation from Maven Central
The latest stable versions are available at Maven Central.
To include API client and the uploading widget in your Android project, add
these lines to the build.gradle file:
Note: uploadcare-android-widget depends on uploadcare-android transitively. If you use the widget and call the REST/Upload API directly, declare both dependencies at the same version.
Android 14+ and foreground services
The uploading widget performs background uploads through WorkManager. Starting with version 4.3.2, the widget declares the required foreground service type (dataSync) and the FOREGROUND_SERVICE_DATA_SYNC permission in its own manifest, so apps targeting Android API 34 or higher work without extra setup.
If your app runs its own long-running WorkManager workers with other foreground service types, combine them with dataSync in your AndroidManifest.xml:
Initialization
REST API requires both public and secret keys. If you use Upload API only, you can specify just “YOUR_PUBLIC_KEY”. Get your Public and Secret API keys.
Kotlin
Java
For uploading widget, place your Uploadcare public/private keys into the res/values/strings.xml file:
Warning: Do not ship your secret key in a production Android app: it can be extracted from the app binary. The widget only needs the public key. Set the secret key for local testing only, and route REST API operations that require it through your backend in production.
Using REST API
You can use both synchronous and asynchronous operations.
Asynchronous file info fetch
Kotlin
Java
Synchronous file info fetch
Kotlin
Java
Find out more examples in the API client documentation for Android at GitHub.
Using Upload API
You can use both synchronous and asynchronous operations.
Asynchronous file upload
Kotlin
Java
Synchronous file upload
Kotlin
Java
Find out more examples in the API client documentation for Android at GitHub.
Using uploading widget
You can select and upload file from any available local file, camera, external source, Activity/Fragment.
Kotlin
Java
Find out more examples in the uploading widget documentation for Android at GitHub.
Related guides
- Integration with Java