Sunday, July 14, 2013

A quick look at Dropbox’s new Datastore API

Inline image 2

Dropbox released a new API for mobile app developers yesterday at their DBX conference: a Datastore API which allows you to sync data between a user's devices in real-time, via their dropbox account.

As soon as the keynote ended, we rushed back to Xamarin HQ and dove right in. We decided to write a simple iOS app that would sync the positions of various cute monkeys between devices. Our app is written in C# and it's called MonkeyBox. Check it out:

Arrange the monkeys to your satisfaction, scale and rotate them, and watch them sync automatically across all your devices. You can browse the MonkeyBox code by adding the Dropbox Sync component to your project, or check it out on Github.

Ok, let's take a look at the Datastore API.

The first step is to get the user to authorize their Dropbox account. Here's how you do that:

var manager = new DBAccountManager ("DROPBOX_APP_KEY", "SYNC_KEY");
var account = manager.LinkedAccount;
if (account == null)
   manager.LinkFromController (window.RootViewController); // logs in.

Read more: Xamarin blog
QR: Inline image 1