Warning: API v1 has been deprecated. Learn more.

Datastore API SDKs

Warning: The Datastore API has been deprecated. Learn more.

The Datastore API lets you effortlessly sync all of your app's structured data such as contacts, to-do items, and game state. It enables your app to sync data quickly, manage conflicting changes, and even work offline.

Before building an app using the Datastore API, you'll need to create an app on the App Console.

Android SDK

The Datastore API requires Android API 10 or later.

Installing the SDK

Download the Datastore API Android SDK linked above. The necessary libraries are located in the libs directory of the SDK package. The .jar file in the libs directory contains the Java classes which make up the Android SDK. The subdirectories contain the native components, built for each supported Android platform. You can safely omit some of them if you know which platforms your app needs to support ("armeabi" is the most common).

Adding the SDK to an Eclipse project

  1. Copy the contents of the libs directory of the Android SDK package into the libs directory of your project.
  2. In Eclipse, open the context menu on your project and click Refresh.

Optional: Installing the Javadocs

To allow Eclipse to display Javadoc documentation for SDK classes, you can create a dropbox-sync-sdk-android.jar.properties file in your project's libs directory containing a path to the javadoc directory of the Android SDK package as follows.

# Replace the path below with the correct path on your system

Once you've added the SDK to your project, jump to the "Required changes to AndroidManifest.xml" section to complete the setup.

Adding the SDK to an Android Studio project

The following instructions apply to version 0.9.2 of Android Studio and version 0.14.1 of the Android tools plugin for Gradle. If you're using a different version, you may need to modify some of the steps.

  1. Within Android Studio, switch to the "project view".
  2. From the libs directory in the downloaded SDK, drag dropbox-sync-sdk-android.jar into your project's app/libs directory.
  3. Right-click on dropbox-sync-sdk-android.jar and choose "Add as library". Click "OK" on the dialog that appears.
  4. Make a new directory in your project under app/src/main called jniLibs. From the SDK, drag armeabi, armeabi-v7a, mips, and x86 into the new jniLibs directory.

Read on for other changes you need to make to your project before using the SDK.

Required changes to AndroidManifest.xml

The Datastore API needs permission to access the Internet. Additionally, a few SDK components need to be published so that Android can find them. Here are the two snippets to add to your AndroidManifest.xml.

Required permissions (inside the <manifest> element).
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Activities and Services (inside the <application> element).
Be sure to replace the APP_KEY below with your real Dropbox app key, which can be found in the App Console.
<activity android:name="com.dropbox.sync.android.DbxAuthActivity" />
  android:launchMode="singleTask" >
    <data android:scheme="db-APP_KEY" />
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.BROWSABLE" />
    <category android:name="android.intent.category.DEFAULT" />
  android:label="Dropbox Sync" />

Example apps

  • Lists - A sample app that demonstrates many features of the Datastore API.
  • Click the Box - A simple app for storing game state using the Datastore API.

More info