We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
kaftanati
9 years agoHelpful | Level 6
How I can do unlink() for account at Android (with API v2)?
Android Core API v1 have method for unlink account from app: mAccountManager.unlink(); Now I can't find same functional.
- 9 years ago
In the API v2 Java SDK, the equivalent would be the calling tokenRevoke to revoke the token, and then throwing the local copy of the access token.
Oleg3
9 years agoHelpful | Level 5
Greg, thanks a lot.
I add new code to DropboxClientFactory for tokenRevoke() using AsyncTask:
public static void revokeClient(final CallBack callBack) {new AsyncTask<Void, Void, Void>() {
protected Void doInBackground(Void... params) {
try {
sDbxClient.auth().tokenRevoke();
} catch (DbxException e) {
}
return null;
} // doInBackground
protected void onPostExecute(Void aVoid) {
sDbxClient = null;
if (callBack != null)
callBack.onRevoke();
}
}.execute();
} // revokeClient
public interface CallBack{
void onRevoke();
} // CallBack But I dont know how to call it from the main thread. Could you help me?
Sorry for the arrogance..... and thanks in advance.
Greg-DB
Dropbox Community Moderator
9 years agoIt sounds that's more about Java threading/tasks which is outside the scope of Dropbox API support, so I'm afraid I can't be of help with that.
- Oleg39 years agoHelpful | Level 5Thanks at all.
p.s. I thought Dropbox has some example to do revoke the token (as it was done for v1).
Could you at least provide me to some referenece or example how to apply the revoke function?
Thanks.- Greg-DB9 years ago
Dropbox Community Moderator
Using tokenRevoke as discussed is the right way to revoke an access token using the Dropbox API v2 Java SDK. I don't believe we have a code sample for using that on Android in particular, but we do have a sample Android app that uses the SDK to make other calls. For example, it defines and calls a ListFolderTask.
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!