Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hello, I deleted the v1 dropbox sdk from my android app and added 3.0.4. The following things are not recognizable by android studio. Where can I check out what to use intead of (for example) AndroidAuthSession?
Thanks
AndroidAuthSession,
DropboxException
DropboxAPI
private AndroidAuthSession buildSession() throws DropboxException {
AppKeyPair appKeyPair = new AppKeyPair(APP_KEY, APP_SECRET);
AndroidAuthSession session = new AndroidAuthSession(appKeyPair);
session.setOAuth2AccessToken(ACCESSTOKEN);
return session;
}
AndroidAuthSession session = null;
try {
session = buildSession();
} catch (DropboxException e) {
e.printStackTrace();
}
dropboxAPI = new DropboxAPI<>(session);
String[] fnames;
DropboxAPI.Entry dirent = null;
try {
dirent = dropboxAPI. metadata("/", 1000, null, true, null);
} catch (DropboxException e) {
e.printStackTrace();
}
ArrayList<DropboxAPI.Entry> files = new ArrayList<>();
For Android, we recommend using the official Dropbox API v2 Java SDK:
https://github.com/dropbox/dropbox-sdk-java
It sounds like you've already installed that. It doesn't use the same classes/interface as the old version, so you'll need to update your code. There's an example Android app using it here:
https://github.com/dropbox/dropbox-sdk-java/tree/master/examples/android
For instance, your AndroidManifest.xml should be set up as shown here:
You start the flow by calling startOAuth2Authentication as shown here:
You complete the flow by calling getOAuth2Token as shown here:
Your app can store and re-use the resulting access token for that user, as the example does here:
You can find examples of calling getMetadata and listFolder here:
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!