<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How I can do unlink() for account at Android (with API v2)? in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/240115#M13353</link>
    <description>&lt;P&gt;Using&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.1.x/com/dropbox/core/v2/auth/DbxUserAuthRequests.html#tokenRevoke--" target="_self" rel="nofollow noopener noreferrer"&gt;tokenRevoke&lt;/A&gt;&amp;nbsp;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 &lt;A href="https://github.com/dropbox/dropbox-sdk-java/tree/master/examples/android" target="_self"&gt;a sample Android app&lt;/A&gt; that uses the SDK to make other calls. For example, it &lt;A href="https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/android/src/main/java/com/dropbox/core/examples/android/ListFolderTask.java" target="_self"&gt;defines&lt;/A&gt; and &lt;A href="https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/android/src/main/java/com/dropbox/core/examples/android/FilesActivity.java#L176" target="_self"&gt;calls&lt;/A&gt;&amp;nbsp;a&amp;nbsp;ListFolderTask.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Sep 2017 15:18:47 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2017-09-05T15:18:47Z</dc:date>
    <item>
      <title>How I can do unlink() for account at Android (with API v2)?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/209787#M10431</link>
      <description>&lt;P&gt;Android Core API v1 have method for unlink account from app:&lt;/P&gt;&lt;PRE&gt;mAccountManager.unlink();&lt;/PRE&gt;&lt;P&gt;Now I can't find same functional.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:25:11 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/209787#M10431</guid>
      <dc:creator>kaftanati</dc:creator>
      <dc:date>2019-05-29T09:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: How I can do unlink() for account at Android (with API v2)?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/209796#M10432</link>
      <description>*moves to API forum*</description>
      <pubDate>Sat, 04 Mar 2017 17:49:00 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/209796#M10432</guid>
      <dc:creator>Mark</dc:creator>
      <dc:date>2017-03-04T17:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: How I can do unlink() for account at Android (with API v2)?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/210084#M10464</link>
      <description>&lt;P&gt;In the API v2 Java SDK, the equivalent would be the calling &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.1.x/com/dropbox/core/v2/auth/DbxUserAuthRequests.html#tokenRevoke--" target="_self"&gt;tokenRevoke&lt;/A&gt; to revoke the token, and&amp;nbsp;then throwing the local copy of the access token.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 19:25:52 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/210084#M10464</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-03-06T19:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: How I can do unlink() for account at Android (with API v2)?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/210206#M10484</link>
      <description>&lt;P&gt;My mistake was - I didn't clear local stored token. Now all worked, thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 08:41:35 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/210206#M10484</guid>
      <dc:creator>kaftanati</dc:creator>
      <dc:date>2017-03-07T08:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: How I can do unlink() for account at Android (with API v2)?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/239585#M13325</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I use this DropboxClientFactory:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public class DropboxClientFactory {

    private static DbxClientV2 sDbxClient;

    public static void init(String accessToken) {
    	if (sDbxClient == null) {
            DbxRequestConfig requestConfig = DbxRequestConfig.newBuilder("myApp").build();
            sDbxClient = new DbxClientV2(requestConfig, accessToken);
    	}
    }
    
    public static DbxClientV2 getClient() {
        if (sDbxClient == null) {
            throw new IllegalStateException("Client not initialized.");
        }
        return sDbxClient;
    }

    public static Boolean tokenRevoke() {
    	Boolean result = false;
    	if (sDbxClient != null) {
    		try {
    		   sDbxClient.auth().tokenRevoke();
    		   result = true;
    		} catch (DbxApiException e) {
    		} catch (DbxException e) {
	       	}
    	} 
		return result;
    }   
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some questions/problems:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. In most examples, DbxRequestConfig is like this (with .withHttpRequestor(new OkHttp3Requestor(OkHttp3Requestor.defaultOkHttpClient())))&lt;/P&gt;&lt;PRE&gt;DbxRequestConfig requestConfig = DbxRequestConfig.newBuilder("examples-v2-demo")
&lt;STRONG&gt;.withHttpRequestor(new OkHttp3Requestor(OkHttp3Requestor.defaultOkHttpClient()))&lt;/STRONG&gt;
.build();&lt;/PRE&gt;&lt;P&gt;I use it without "OkHttpRequestor". Is it necessary?&lt;/P&gt;&lt;P&gt;I would like to add it, but i recive the error on it: "The type okhttp3.OkHttpClient cannot be resolved. It is indirectly referenced from required .class files". How could I resolve it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. App&amp;nbsp;links to dropbox and upload/download the file without the problem. But on revoke the token (calling tokenRevoke() ) i recieve the error: "android.os.NetworkOnMainThreadException". &amp;nbsp;And this error is not catched by&amp;nbsp;DbxApiException and &amp;nbsp;DbxException.&lt;/P&gt;&lt;P&gt;What is wrong? Why this error is not catched? What type of Exception i need to use to catch all errors of Dropbox?&lt;/P&gt;&lt;P&gt;I use general "Exception e", it catches the error, but "e.getMessage()" returns NULL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 16:24:59 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/239585#M13325</guid>
      <dc:creator>Oleg3</dc:creator>
      <dc:date>2017-09-01T16:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: How I can do unlink() for account at Android (with API v2)?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/239592#M13326</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/475495"&gt;@Oleg3&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;1. Use of &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/http/OkHttpRequestor.html" target="_self"&gt;`&lt;/A&gt;&lt;SPAN&gt;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/http/OkHttpRequestor.html" target="_self"&gt;OkHttpRequestor`&lt;/A&gt; (or &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/http/OkHttp3Requestor.html" target="_self"&gt;`OkHttp3Requestor`&lt;/A&gt;) is not required. If you don't use it, the SDK will fall back to using &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/http/StandardHttpRequestor.html" target="_self"&gt;`StandardHttpRequestor`&lt;/A&gt;&amp;nbsp;by default.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you do want to use one, you need to include the relevant OkHttp library, for example as &lt;A href="https://github.com/dropbox/dropbox-sdk-java/blob/6ba8d5a9ec9d28be69dbb3ddf74ded48b728f466/examples/android/build.gradle#L67" target="_self"&gt;shown here&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. &lt;A href="https://developer.android.com/reference/android/os/NetworkOnMainThreadException.html" target="_self"&gt;`NetworkOnMainThreadException`&lt;/A&gt;&amp;nbsp;is not a&amp;nbsp;Dropbox exception, so you can't catch it using a&amp;nbsp;Dropbox exception type. You can catch it using `Exception`, but you should write your app to avoid it in the first place. In short, you can't make a network call (such as a&amp;nbsp;Dropbox API call) on the mean thread. The Android&amp;nbsp;&lt;A href="https://developer.android.com/reference/android/os/NetworkOnMainThreadException.html" target="_self"&gt;`NetworkOnMainThreadException`&lt;/A&gt;&amp;nbsp;documentation has more information, and &lt;A href="https://stackoverflow.com/search?q=NetworkOnMainThreadException" target="_self"&gt;there are some samples on StackOverflow&lt;/A&gt; as well.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 16:48:17 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/239592#M13326</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-09-01T16:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: How I can do unlink() for account at Android (with API v2)?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/239618#M13328</link>
      <description>&lt;P&gt;Greg, thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I add new code to&amp;nbsp;DropboxClientFactory for tokenRevoke() using AsyncTask:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    public static void revokeClient(final CallBack callBack) {new AsyncTask&amp;lt;Void, Void, Void&amp;gt;() {
    	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 &lt;/PRE&gt;&lt;P&gt;But I dont know how to call it from the main thread. Could you help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the arrogance..... and thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 19:04:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/239618#M13328</guid>
      <dc:creator>Oleg3</dc:creator>
      <dc:date>2017-09-01T19:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: How I can do unlink() for account at Android (with API v2)?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/239621#M13329</link>
      <description>It 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.</description>
      <pubDate>Fri, 01 Sep 2017 19:36:01 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/239621#M13329</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-09-01T19:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: How I can do unlink() for account at Android (with API v2)?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/239699#M13333</link>
      <description>Thanks at all.&lt;BR /&gt;p.s. I thought Dropbox has some example to do revoke the token (as it was done for v1).&lt;BR /&gt;Could you at least provide me to some referenece or example how to apply the revoke function?&lt;BR /&gt;Thanks.</description>
      <pubDate>Sat, 02 Sep 2017 15:01:47 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/239699#M13333</guid>
      <dc:creator>Oleg3</dc:creator>
      <dc:date>2017-09-02T15:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: How I can do unlink() for account at Android (with API v2)?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/240115#M13353</link>
      <description>&lt;P&gt;Using&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.1.x/com/dropbox/core/v2/auth/DbxUserAuthRequests.html#tokenRevoke--" target="_self" rel="nofollow noopener noreferrer"&gt;tokenRevoke&lt;/A&gt;&amp;nbsp;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 &lt;A href="https://github.com/dropbox/dropbox-sdk-java/tree/master/examples/android" target="_self"&gt;a sample Android app&lt;/A&gt; that uses the SDK to make other calls. For example, it &lt;A href="https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/android/src/main/java/com/dropbox/core/examples/android/ListFolderTask.java" target="_self"&gt;defines&lt;/A&gt; and &lt;A href="https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/android/src/main/java/com/dropbox/core/examples/android/FilesActivity.java#L176" target="_self"&gt;calls&lt;/A&gt;&amp;nbsp;a&amp;nbsp;ListFolderTask.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 15:18:47 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-I-can-do-unlink-for-account-at-Android-with-API-v2/m-p/240115#M13353</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-09-05T15:18:47Z</dc:date>
    </item>
  </channel>
</rss>

