This demo app showcases Ably Live Objects functionality with two interactive features:
- Color Voting: Real-time voting system where users can vote for their favorite color (Red, Green, Blue) and see live vote counts synchronized across all devices
- Task Management: Collaborative task management where users can add, edit, and delete tasks that sync in real-time across all connected devices
Follow the steps below to get started with the Live Objects demo app
Ensure you have the following installed:
- Android Studio (latest stable version)
- Java 17 or higher
- Android SDK with API Level 34 or higher
Add your Ably key to the local.properties file:
sdk.dir=/path/to/android/sdk
EXAMPLES_ABLY_KEY=xxxx:yyyyyy- Open in Android Studio
- Open Android Studio.
- Select File > Open and navigate to the cloned repository.
- Open the project.
- Sync Gradle
- Wait for Gradle to sync automatically.
- If it doesn’t, click on Sync Project with Gradle Files in the toolbar.
- Configure an Emulator or Device
- Set up an emulator or connect a physical Android device.
- Ensure the device is configured with at least Android 5.0 (API 21).
- Run the App
- Select your emulator or connected device in the device selector dropdown.
- Click on the Run button
▶️ in the toolbar or press Shift + F10.
-
View the App
Once the build is complete, the app will be installed and launched on the selected device or emulator.
The app opens with two tabs:
-
Color Voting Tab:
- Vote for Red, Green, or Blue colors
- See real-time vote counts that update instantly across all devices
- Reset all votes with the "Reset all" button
-
Task Management Tab:
- Add new tasks using the text input and "Add Task" button
- Edit existing tasks by clicking the edit icon
- Delete individual tasks or remove all tasks at once
- See the total task count and real-time updates as tasks are modified
To see the real-time synchronization in action, run the app on multiple devices or emulators with the same Ably key.
This is useful to check ProGuard rules, app size, etc.
- Create signing keys for the Android app
keytool -genkey -v -keystore release.keystore \
-storepass <store-password> \
-alias <key-alias> \
-keypass <key-password> \
-keyalg RSA -keysize 2048 -validity 25000 -dname "CN=Ably Example App,OU=Examples,O=Ably,L=London,ST=England,C=GB"- Update
local.propertiesfile:
EXAMPLES_STORE_FILE=/absolute/path/to/release.keystore
EXAMPLES_STORE_PASSWORD=<store-password>
EXAMPLES_KEY_ALIAS=<key-alias>
EXAMPLES_KEY_PASSWORD=<key-password>- Build release APK
./gradlew :examples:assembleRelease - Install to the device
adb install -r examples/build/outputs/apk/release/examples-release.apk - SDK Not Found: Install missing SDK versions from File > Settings > Appearance & Behavior > System Settings > Android SDK.
- Build Failures: Check the error logs and resolve dependencies or configuration issues.