Upgrade from Stitch to Realm - Java SDK
On this page
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.
New Features
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.
Changes
What's Changed? | Solution |
---|---|
The backend app connections previously accessed via StitchAppClient are now accessed through App. | Migrate all occurrences of |
Application users previously accessed via StitchUser are now accessed through User. | Migrate all occurrences of |
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 | Rewrite all asynchronous Stitch SDK requests to use |
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 | Rewrite all logout logic to use the user's |
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 | Refactor all imports of the MongoDB Data Access API to use |
The BSON package, which contains BSON data types and the | Refactor all imports of the BSON package to use |
Convert SDK service API usage in your application to Realm functions using the corresponding npm packages. For more information, see Add External Dependencies. |