Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
rekte
9 years agoExplorer | Level 3
AndroidAuthSession, DropboxException are not recognizable
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<>();
1 Reply
- Greg-DB9 years ago
Dropbox Community Moderator
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:
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
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!