Dropbox Core and Sync APIs together in Android App -


is possible use both core , sync api in 1 android app?

it possible use them together. it's 2 part setup.

removing project errors:

  1. add jar files both sdks project
  2. now open dropbox core sdk jar file , remove client2.auth classes - that's causing namespace collision. see errors until fixed

authenticating sdks:

  1. setup dropbox linking sync sdk - there many docs on this
  2. get oauth credentials sync sdk core sdk using:

      appkeypair appkeypair = new appkeypair(app_key, app_secret);   androidauthsession session = new androidauthsession(appkeypair);   session.setoauth2accesstoken(gettokenfromsyncapi());   session.finishauthentication(); 

and finally, missing method:

string gettokenfromsyncapi() {     string token = null;      string alltokens = getapplicationcontext().getsharedpreferences("dropbox-credentials",             context.mode_private).getstring("accounts", null);      try {         jsonarray jsonaccounts = new jsonarray(alltokens);         if (jsonaccounts.length() > 0) {             string tmptoken = null;             tmptoken = jsonaccounts.getjsonobject(0).getstring("usertoken");              // take oauth2 tokens             if (tmptoken.startswith("|oa2|"))                 token = tmptoken.substring(5);         }     } catch (jsonexception e) {         e.printstacktrace();     }      return token; } 

method courtesy : https://blogs.dropbox.com/developers/2015/05/migrating-sync-sdk-access-tokens-to-core-sdk/

ps : method shown @ link has bug. substring(6) instead of 5


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -