Introduction

ObjectBox is a mobile database that persists objects simple and super fast. It lets you avoid many repetitive tasks and offers a simple interface to your data.

Gradle plugin and code generation

In order to use ObjectBox in your Android project, you need to add its Gradle plugin and Android library:

Then model your entities and make your project, for example using “Build > Make Project” in Android Studio.

Latest versions and updates

We use a custom Maven repository. At this point this repository is for private testers only, and thus we don’t publish it on Maven Central or jCenter. For updates, check the changelog to track new features and fixes of recent versions.

Core Classes

Once your project is built, you can start using ObjectBox in your Android project.

The following core classes are the essential interface to ObjectBox:

MyObjectBox: Generated based on your entity classes MyObjectBox supplies a builder to set up a BoxStore for your app.

BoxStore: The entry point for using ObjectBox. BoxStore is your direct interface to the database and manages Box classes (not objects).

Box: A box persists and queries for entities. For each entity, a Box can be supplied by the BoxStore.

Entities: Your objects that can be persisted. Usually, entities are objects representing a database row using standard Java properties (like a POJO or a JavaBean).

Core Initialization

Finally, the basic steps to initialize the core ObjectBox classes:

The example assumes a Note entity exists. With its Box ( notesBox object), we can call the persistence operation for this specific entity.

Have an app with greenDAO? DaoCompat is for you!

DaoCompat is an compatibility layer that gives you an greenDAO like API for ObjectBox. This makes switching simple. Have a look at the example. Docs will follow, contact us if you have any questions!

Further Docs

ObjectBox Documentation