Docs Menu

Docs HomeDevelop ApplicationsAtlas Device SDKs

Upgrade from Stitch to Realm - Java SDK

On this page

  • New Features
  • Changes

If you have an existing app built with the Stitch SDK, you should migrate your app to use the new Realm SDK. While much of the logic and flow of information hasn't changed, there are a few important changes in the way your app connects to the realm backend.

  • The Realm Java SDK supports Android applications written in Kotlin.

  • The Realm Java SDK now includes Realm Database, which includes local object storage and Sync.

What's Changed?
Solution
The backend app connections previously accessed via StitchAppClient are now accessed through App.
Migrate all occurrences of StitchAppClient to App.
Application users previously accessed via StitchUser are now accessed through User.
Migrate all occurrences of StitchUser to User.
In the Stitch SDK, network requests like callFunction() were asynchronous by default. In the Realm Java SDK, you can choose synchronous or asynchronous requests with the "Async" suffix, e.g. callFunction() and callFunctionAsync().
Migrate all asynchronous Stitch SDK requests to their asynchronous Realm SDK equivalents.
Async SDK requests no longer use the built-in Android Task class to return success status and values via onComplete(); instead, Async requests now use a App.Callback to return success status and values via onResult().
Rewrite all asynchronous Stitch SDK requests to use App.Callback and onResult().
The login API has changed from stitchAppClient.getAuth().loginWithCredential() to app.loginAsync() or the synchronous equivalent app.login().
Rewrite all authentication logic to use the new login API.
The Stitch SDK used stitchAppClient.getAuth().logout() to handle user logout. To logout a user in the Realm SDK, call the logOut() method of that user's User object.
Rewrite all logout logic to use the user's User object instead of the StitchAppClient.
Instead of calling functions using the app client directly, like stitchAppClient.callFunction(), you can only call functions through a Functions Manager, which you can access through your backend realm app connection: app.getFunctions(user).callFunctionAsync().
Call functions using a Functions Manager instead of an app client.
The MongoDB Data Access API, which contains objects like MongoClient, MongoDatabase, and MongoCollection has changed packages from com.mongodb.client to io.realm.mongodb.mongo.
Refactor all imports of the MongoDB Data Access API to use io.realm.mongodb.mongo.
The BSON package, which contains BSON data types and the Document data type for reading/writing to MongoDB Atlas, has moved from com.mongodb.stitch.core.internal.common to org.bson.
Refactor all imports of the BSON package to use io.realm.mongodb.mongo.
The Realm SDK does not provide an interface for calling services such as Twilio and AWS.
Convert SDK service API usage in your application to Realm functions using the corresponding npm packages. For more information, see Add External Dependencies.
Welcome to the Atlas Device SDK Docs →