Atlas Device SDK for Java
Use the Atlas Device SDK for Java to develop Android apps in Java or Kotlin. To develop multiplatform apps using Kotlin Multiplatform (KMP), refer to the Kotlin SDK.
SDK in Maintenance Mode
This SDK is in best-effort maintenance mode and no longer receives new development or non-critical bug fixes. To develop your app with new features, use the Kotlin SDK. You can use the Java SDK with the Kotlin SDK.
Learn more about how to Migrate from the Java SDK to the Kotlin SDK.
Develop Apps with the SDK
Use the SDK's open-source database - Realm - as an object store on the device. Use Device Sync to keep data in sync with your MongoDB Atlas cluster and other clients.
Install the Java SDK
Use the Gradle build system to install the Java SDK in your project.
Define an Object Schema
Use Java or Kotlin to idiomatically define an object schema.
Open a Database
The SDK's database - Realm - stores objects in files on your device. Or you can open an in-memory database which does not create a file. To get started reading and writing data, configure and open a database.
Read and Write Data
Create, read, update, and delete objects from the database. Use Android-native queries to filter data.
React to Changes
Live objects mean that your data is always up-to-date. You can register a notification handler to watch for changes and perform some logic, such as updating your UI.
Connect to an Atlas App Services App
Configure Device Sync in an App Services App. Define data access rules. Use Development Mode to infer your schema from your Java or Kotlin data model.
Then, connect to the backend from your client.
Authenticate a User
Use one of our authentication providers to authenticate a user. App Services provides access to popular authentication providers, such as Apple, Google, or Facebook. Use our built-in email/password provider to manage users without a third-party, or use custom JWT authentication to integrate with other authentication providers. Anonymous authentication provides access without requiring a login or persisting user data.
Open a Synced Database
Configure and open a synced database. Subscribe to a query to determine what data the synced database can read and write.
Read and Write Synced Data
The APIs to read and write data are the same whether you're using a synced or non-synced database. Data that you read and write is automatically kept in sync with your Atlas cluster and other clients. Apps keep working offline and deterministically sync changes whenever a network connection is available.
Call Serverless Functions
You can call serverless Functions from your client application that run in an App Services backend.
Query MongoDB Atlas
You can query data stored in MongoDB directly from your client application code.
Authenticate Users
Authenticate users with built-in and third-party authentication providers. Use the authenticated user to access App Services.
Recommended Reading
Kotlin Extensions API Reference
Explore generated reference docs for the Kotlin Extensions APIs.