You need Android Studio installed. These instructions are based on version 3.0.

Prerequisites

Before beginning make sure you have Realm Object Server installed and running.

Clone the RealmTasks repo: git clone https://github.com/realm-demos/realm-tasks.git which include the source code for RealmTasks Android.

Open RealmTasks

Open Android Studio and choose Open an existing Android Studio Project:

Android Studio

Navigate to the containing folder of the cloned repo then open: /realm-tasks/RealmTasks Android:

Open RealmTasks in Android Studio

Build and Run RealmTasks

Before building RealmTasks, you must ensure the application is configured to connect to Realm Object Server on the correct IP address.

By default, in RealmTasksApplication.java your local IP address is used via a build configuration step:

public class RealmTasksApplication extends Application {

    public static final String AUTH_URL = "http://" + BuildConfig.OBJECT_SERVER_IP + ":9080/auth";
    public static final String REALM_URL = "realm://" + BuildConfig.OBJECT_SERVER_IP + ":9080/~/realmtasks";

    ...
}

If you have the Realm Object Server running locally, you can build and run as is.

However, if you installed Realm Object Server for Linux on another machine, you will need to adjust the default IP address to point to your server address.

With the correct IP address in place, click Run in the file menu and then Run 'app' to build and run on either an Android emulator or device.

Using the App

On first launch, you will need to register a username and password by clicking Register in the top right hand corner. Choose a username and password, then click Register to continue.

Congrats! You are now in the default task list for the application.

You can enter new tasks by slowly dragging downward until a new Task entry appears. Any entries you create will be instantly synchronized by the Realm Object Server and appear on other devices, or in the macOS or iOS versions as well.

RealmTasks for Android

Swiping left or right on items in the task list in the application will delete or mark items as “done.” Here too, these changes will be immediately reflected in the other version of the application.

Observing Changes In Realm Studio

You can use Realm Studio to explore and interact with synchronized Realm data in realtime.

Realm Studio starting screen

After opening the app, click “Connect to Realm Object Server” and then press “Connect”. The default settings in Realm Studio will connect to the local Realm Object Server. If it is running on another machine, change the IP address to that location.

Using Realm Studio to connect to the Realm Object Server

A new dialog box will open, listing all the Realms on your server. The Realm used by the RealmTask app is named /<UserId>/realmtasks.

See all Realms on the server

If you still have the RealmTasks app open, you can now try editing and reordering your tasks while seeing the changes live in the browser. Changes in the browser are reflected instantly in the app as well.

Browse and interact with data in the Realm

What’s Next?

Learn more about the Realm Mobile Platform by exploring the documentation: