<?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 Android API get account email in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-API-get-account-email/m-p/288508#M17652</link>
    <description>&lt;P&gt;I am not able to get the user account email after the authentication:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this code (in Kotlin) on my onResume&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;mDBApi&lt;/SPAN&gt;!!.&lt;SPAN&gt;session&lt;/SPAN&gt;.finishAuthentication()&lt;BR /&gt;&lt;SPAN&gt;val &lt;/SPAN&gt;accessToken = &lt;SPAN&gt;mDBApi&lt;/SPAN&gt;!!.&lt;SPAN&gt;session&lt;/SPAN&gt;.&lt;SPAN&gt;oAuth2AccessToken&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;val &lt;/SPAN&gt;client = DbxClientV2(DbxRequestConfig.newBuilder(&lt;SPAN&gt;"dropbox/MyAppName"&lt;/SPAN&gt;).build()&lt;SPAN&gt;, &lt;/SPAN&gt;accessToken)&lt;BR /&gt;&lt;SPAN&gt;val &lt;/SPAN&gt;email = client.users().&lt;SPAN&gt;currentAccount&lt;/SPAN&gt;.&lt;SPAN&gt;email&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;but the getCurrentAccount() throws me 'android.os.NetworkOnMainThreadException'.&lt;/P&gt;&lt;P&gt;How can I solve this to get the user&amp;nbsp;&lt;SPAN&gt;account email?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:11:21 GMT</pubDate>
    <dc:creator>carminelaf</dc:creator>
    <dc:date>2019-05-29T09:11:21Z</dc:date>
    <item>
      <title>Android API get account email</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-API-get-account-email/m-p/288508#M17652</link>
      <description>&lt;P&gt;I am not able to get the user account email after the authentication:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this code (in Kotlin) on my onResume&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;mDBApi&lt;/SPAN&gt;!!.&lt;SPAN&gt;session&lt;/SPAN&gt;.finishAuthentication()&lt;BR /&gt;&lt;SPAN&gt;val &lt;/SPAN&gt;accessToken = &lt;SPAN&gt;mDBApi&lt;/SPAN&gt;!!.&lt;SPAN&gt;session&lt;/SPAN&gt;.&lt;SPAN&gt;oAuth2AccessToken&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;val &lt;/SPAN&gt;client = DbxClientV2(DbxRequestConfig.newBuilder(&lt;SPAN&gt;"dropbox/MyAppName"&lt;/SPAN&gt;).build()&lt;SPAN&gt;, &lt;/SPAN&gt;accessToken)&lt;BR /&gt;&lt;SPAN&gt;val &lt;/SPAN&gt;email = client.users().&lt;SPAN&gt;currentAccount&lt;/SPAN&gt;.&lt;SPAN&gt;email&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;but the getCurrentAccount() throws me 'android.os.NetworkOnMainThreadException'.&lt;/P&gt;&lt;P&gt;How can I solve this to get the user&amp;nbsp;&lt;SPAN&gt;account email?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:11:21 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-API-get-account-email/m-p/288508#M17652</guid>
      <dc:creator>carminelaf</dc:creator>
      <dc:date>2019-05-29T09:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Android API get account email</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-API-get-account-email/m-p/288590#M17662</link>
      <description>You're getting a NetworkOnMainThreadException, which means you're trying to make a network call on the main thread, which isn't allowed on Android. (The Dropbox API methods each make a network call to the Dropbox API servers.) You should make this call on a background thread instead. This isn't specific to Dropbox, so there are several answers about how to do this on StackOverflow, e.g.:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://stackoverflow.com/questions/6343166/android-os-networkonmainthreadexception" target="_blank"&gt;https://stackoverflow.com/questions/6343166/android-os-networkonmainthreadexception&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;There's also an example of doing this in the Android sample app included with the Dropbox API v2 Java SDK:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/dropbox/dropbox-sdk-java/blob/7ecc15cf0f51d6ae2ba5cdb334aac2c2f3474b87/examples/android/src/main/java/com/dropbox/core/examples/android/GetCurrentAccountTask.java#L12" target="_blank"&gt;https://github.com/dropbox/dropbox-sdk-java/blob/7ecc15cf0f51d6ae2ba5cdb334aac2c2f3474b87/examples/android/src/main/java/com/dropbox/core/examples/android/GetCurrentAccountTask.java#L12&lt;/A&gt;</description>
      <pubDate>Thu, 02 Aug 2018 16:32:59 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-API-get-account-email/m-p/288590#M17662</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-08-02T16:32:59Z</dc:date>
    </item>
  </channel>
</rss>

