27 ratings
  • 1
  • 2
  • 3
  • 4
  • 5
5 star 12
4 star 6
3 star 2
2 star 4
1 star 3
Compatible with
  • iOS
  • Android

Dropbox Sync & Datastore 3.0.0

Xamarin, Inc.

Give your app its own private Dropbox client and leave the syncing to Dropbox.

The Dropbox Sync API allows you to give your app its own private Dropbox client and leave the syncing to Dropbox.

  • Focus on your data. The Sync API handles all the caching, retrying, and file change notifications.
  • Writes are local so changes are immediate. The Sync API syncs to Dropbox behind the scenes.
  • Your app works great even when offline and automatically syncs when it's back online.

Datastore API

Keep your app's structured data in sync with Dropbox. These days, your app need to store and sync more than just files. With the Datastore API, structured data like contacts, to-do items, and game state can be synced effortlessly. Datastores work across platforms, offline, and even support automatic conflict resolution.

Authenticating with Dropbox

Add the following lines of code to link a user's Dropbox account to your app:

In AppDelegate.cs

using DropBoxSync.iOS;
...

// Get your own App Key and Secret from https://www.dropbox.com/developers/apps
const string DropboxSyncKey = "YOUR_APP_KEY";
const string DropboxSyncSecret = "YOUR_APP_SECRET";

public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{

    // The account manager stores all the account info. Create this when your app launches
    var manager = new DBAccountManager (DropboxSyncKey, DropboxSyncSecret);
    DBAccountManager.SharedManager = manager;

    var account = manager.LinkedAccount;
    if (account != null) {
        var filesystem = new DBFilesystem (account);
        DBFilesystem.SharedFilesystem = filesystem;
    }   

    // ...
}

public override bool OpenUrl (UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
{
    var account = DBAccountManager.SharedManager.HandleOpenURL (url);
    if (account != null) {
        var filesystem = new DBFilesystem (account);
        DBFilesystem.SharedFilesystem = filesystem;
        Console.WriteLine ("App linked successfully!");
        return true;
    } else {
        Console.WriteLine ("App is not linked");
        return false;
    }
}

In Info.plist

You'll need to register the url scheme "db-DropboxSyncKey" to complete the authentication flow. Double-click on your app's Info.plist file, select the Advanced Tab, find the URL Types Section, then click Add URL Type and set URL Schemes to db-DropboxSyncKey (i.e. "db-aaa111bbb2222").

Link the user

Once you've added the code above, you're ready to link the user's Dropbox account from your UI. For example, add this snippet to a UI event handler in one of your controllers:

DBAccountManager.SharedManager.LinkFromController (myController)

This will show the Dropbox OAuth screen and ask the user to link their account.

Write a Review

11 reviews

Jose Hernandez rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

The version 3.0.0 have the error when a use

Account = DBAccountManager.GetInstance (ApplicationContext, DropboxSyncKey, DropboxSyncSecret);

In the version 2.0.2.2 not have problem.

Posted on: July 11 / Version: 3.0.0
Tomas rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

Is there any near-future plan to rebuild this component against Xamarin.Android.Support.v4? It's really a show-stopper at the moment. :(

EDIT: The latest build works great, thanks Alex and Xamarin ;)

Posted on: July 8 / Version: 2.0.2.2
Evgeny Loskutov rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

Needs to be updated to reference Xamarin.Android.Support.v4 instead of Mono.Android.Support.v4

Posted on: June 25 / Version: 2.0.2.1
Danny Cabrera rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

Very fun API! Can't wait for the Chooser/Saver type apps API to be available. :)

Posted on: October 25, 2013 / Version: 1.9
Adrian Hans rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

Really good. No problems with the implementation, worked all just fine.

Posted on: October 25, 2013 / Version: 1.0.8
Mikkel Rostock rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

First of all, when you create the Dropbox App (https://www.dropbox.com/developers/apps/create), make sure you select the Sync API since Core (Full Dropbox) obviously won't work with this component.

For those of you using Visual Studio, which doesn't have the same editor for the Info.plist file, here is a guide on how to modify Info.plist manually:

  • Double-click Info.plist to open it in Visual Studio using the standard XML viewer.

- Add this XML section right before the </dict></plist> tags at the end of the file:

<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>Dropbox</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>db-DropboxSyncKey</string>
        </array>
    </dict>
</array>
  • Replace "db-DropboxSyncKey" as described in the guide above.
  • Save the file.
Posted on: October 25, 2013 / Version: 1.0.8
Manuel Sanroman rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

Not work in ARMv7, only on simulator.

Undefined symbols for architecture armv7: "___udivmodsi4", referenced from: _sqlite3BitvecSet in Dropbox.a(sqlite3.o) _sqlite3BitvecClear in Dropbox.a(sqlite3.o) _sqlite3BitvecTest in Dropbox.a(sqlite3.o) ld: symbol(s) not found for architecture armv7

Posted on: October 25, 2013 / Version: 1.0.5
Eirik Berntsen

How is the Android Component coming along? You said Android would be "supported shortly" in early April :)

Posted on: October 25, 2013 / Version: 1.9
Dirko Swanepoel rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

Works fine while the user is linked. If the user unlinks the app on the dropbox website, it still shows as linked using the API, but gives the following error after creating the DBAccountManager.

[WARNING] ERR: DROPBOX_ERROR_AUTH: api.cpp:143: HTTP error 401 Unauthorized

Posted on: October 25, 2013 / Version: 1.9
Justin Moses rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

Had a compatibility issue for Armv7, works fine for Armv7s. Really hoping you guys do an update.. so that it's compatible. Could really use this feature.

Posted on: July 5, 2013 / Version: 1.0.5
Justin Moses rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

Good component.

Posted on: May 22, 2013 / Version: 1.0.8