Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The <code>AccountManager</code> is converting any network errors into <code>IOException</code>'s. A network error could be some sort of unexpected HTTP status, so it might not be directly related to network connectivity. Note that the <code>AccountManager</code> supports some, but not all 'oauth2:' type tokens, so that might be related. Try with a token that is known to be supported. Also look at the logcat for hints, there might be some warnings there. Is this the full stack trace? </p> <p>This works on a GN 4.0.4 (note it is using the system <code>AccountManager</code>, not <code>GoogleAccountManager</code>):</p> <pre><code> AccountManager am = AccountManager.get(this); Account[] accounts = accountManager.getAccountsByType("com.google"); String AUTH_TOKEN_TYPE = "oauth2:https://www.googleapis.com/auth/analytics.readonly"; am.getAuthToken(accounts[0], AUTH_TOKEN_TYPE, null, this, new AccountManagerCallback&lt;Bundle&gt;() { public void run(AccountManagerFuture&lt;Bundle&gt; future) { try { String token = future.getResult().getString(AccountManager.KEY_AUTHTOKEN); System.out.println("token " + token); } catch (...) {} } }, null); </code></pre> <p>Edit: Here's what I get when copying the token type from your post: </p> <pre><code>0000000: 226f 6175 7468 323a 6874 7470 733a 2f2f "oauth2:https:// 0000010: 7777 772e 676f 6f67 6c65 6170 6973 2e63 www.googleapis.c 0000020: 6f6d 2f61 7574 682f 3f3f 616e 616c 7974 om/auth/??analyt 0000030: 6963 732e 7265 6164 6f6e 6c79 220a ics.readonly". </code></pre> <p>Again, this might be my browser or smth, by check your string (esp. last part)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload