The demo demonstrates Device Sync running between an Android, iOS, macOS and JVM app.
- Follow the steps in the Get Started with Atlas tutorial up until (and including) Create a database user for your cluster.
- Or watch the YouTube screencast.
- Follow the Create an App with the App Services UI guide.
- When creating the App, choose the Real-time Sync template.
- Once created, in the App Services console click on your newly created App.
- Keep Dev Mode enabled.
- Navigate to Device Sync through the left navigation menu.
- Under Sync Type, select Flexible Sync (or follow the Enable Flexible Sync guide).
- Under Define Permissions, add:
{
"rules": {},
"defaultRoles": [
{
"name": "owner-read-write",
"applyWhen": {},
"read": {
"_id": "%%user.id"
},
"write": {
"_id": "%%user.id"
}
}
]
}
- Navigate to App Users through the left navigation menu.
- Click on Add New User and enter a fake email and password between 6 and 128 characters.
- Copy the App ID at the top of the left navigation menu.
- Insert the copied ID and the created user/password in shared/src/commonMain/kotlin/io/realm/kotlin/demo/util/Constants.kt:
object Constants {
val MONGODB_REALM_APP_ID = "[REPLACE ME]"
val MONGODB_REALM_APP_USER = "[REPLACE ME]"
val MONGODB_REALM_APP_PASSWORD = "[REPLACE ME]"
}
./gradlew :androidApp:installDebug
./gradlew shared:podInstall
cd iosApp
pod install
open iosApp.xcworkspace
./gradlew shared:podInstall
cd macosApp
pod install
open macosApp.xcworkspace
./gradlew :jvmApp:run