Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
Register now >
Docs Menu
Docs Home
/ /
SDK de Dispositivo Atlas

Upgrade from Stitch to Realm - Java SDK

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?
Solución

Las conexiones de la aplicación backend a las que anteriormente se accedía a través de Cliente de StitchAppAhora se accede a través de la aplicación.

Migrar todas las ocurrencias de StitchAppClient a App.

Los usuarios de la aplicación que antes accedían a través de StitchUser ahora se acceden a través de Usuario.

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.

El SDK de Stitch utilizó stitchAppClient.getAuth().logout() para gestionar el cierre de sesión del usuario. Para cerrar la sesión de un usuario en el SDK de Realm, llama al método logOut() del objeto User de ese usuario.

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.

El SDK de Realm no proporciona una interfaz para invocar servicios como Twilio y AWS.

Convert SDK service API usage in your application to Realm functions using the corresponding npm packages. For more information, see Add External Dependencies.

En esta página