It turns out that my account is being added, at least according to
this trace from logcat:
D/AddAccount( 58): account added: Bundle
[{accountType=com.example.bloa, authto
ken=WEbDlp4trjR3ajXPGn0GthNqrhPAUaJ6gWaKEAo0, authAccount=20341230-
xRIt1kiGskNUW
AsUYyRA0nw39p0ZlmKeUXr5jQfvp}]
That is the correct information. I am intending to to have the
authAccount be the User's OAUTH token and the authtoken be the User's
OAUTH secret. It seems that the infrastructure is claiming that an
account has been created in the AccountManager. Yet it does not show
up in the list of Accounts in Accounts & Sync settings. This is after
I did an Add Account to my authenticator on that settings page.
When I try to call addAccount from within the same package as the
Authenticator, it does not work at all, as described above, dying with
a "bind failure".
I saw this same thing in a thread about AccountManager from November
and that seemed to have ended up in a defect. I'm pretty sure I'm not
seeing the same thing they were. One of them was getting a similar
message that his account had been added that I am getting. Yet, no
accounts are found, either in that list or programatically.
On Jan 23, 9:12 am, Brion Emde <[email protected]> wrote:
> I've researched the earlier threads about AccountManager and still am
> having problems. I'm trying to extend my Twitter OAUTH demo to use the
> AccountManager. I've built the beginnings of a class based on
> AbstractAccountAuthenticator and a Service that seems to do what it is
> supposed to do.
>
> My Authenticator does get installed on a 2.1 Emulator. I can see it
> when I go to the Accounts & Sync Settings app. If I click on Add
> Accounts and then on My Authenticator, I go through the OAUTH process,
> with an Activity being fired off (by the Account Manager?) from the
> KeyIntent that the authenticator returns. The authentication process
> proceeds and the Activity fields the redirection from the browser in
> its onNewIntent() function (it's a SingleInstance activity).
> Everything appears to be working and the Activity returns its results
> the way it seems it is supposed to. The problem is, the new account
> never shows up in the Accounts list on the Accounts & Sync page.
>
> My second problem is that I also have an Activity in the application
> that contains the authenticator. When I try to do an addAccount() from
> that activity, which is my original demo tiny Twitter client, I get a
> very succinct bind failure of my service to the AccountManager.
>
> So, when I run the Authenticator from the Accounts & Sync Settings
> page, it all works, except the new account isn't showing up. When I
> try to run the Authenticator from my Activity which is in the same
> package, I get a bind failure.
>
> Now I'll document how I'm returning the result in the Activity, which
> is derived from AccountAuthenticatorActivity:
>
> �...@override
> public void onNewIntent(Intent i) {
> Bundle b = new Bundle();
> String verifier;
> try {
> Uri data = i.getData();
> if(data == null || (verifier = data.getQueryParameter
> (OAuth.OAUTH_VERIFIER)) == null) {
> b.putInt(AccountManager.KEY_ERROR_CODE,
> -10000);
> b.putString(AccountManager.KEY_ERROR_MESSAGE,
> getString
> (R.string.auth_error));
> mResponse.onError(-10000,
> getString(R.string.auth_error));
> } else {
> mProvider.retrieveAccessToken(verifier);
> String token = mConsumer.getToken();
> String secret = mConsumer.getTokenSecret();
> b.putString(AccountManager.KEY_ACCOUNT_NAME,
> token);
> b.putString(AccountManager.KEY_ACCOUNT_TYPE,
> getString
> (R.string.auth_type));
> b.putString(AccountManager.KEY_AUTHTOKEN, secret);
> mResponse.onResult(b);
> }
> } catch (OAuthMessageSignerException e) {
> b.putInt(AccountManager.KEY_ERROR_CODE, -1);
> b.putString(AccountManager.KEY_ERROR_MESSAGE,
> e.getMessage());
> mResponse.onError(-1, e.getMessage());
> e.printStackTrace();
> } catch (OAuthNotAuthorizedException e) {
> b.putInt(AccountManager.KEY_ERROR_CODE, -2);
> b.putString(AccountManager.KEY_ERROR_MESSAGE,
> e.getMessage());
> mResponse.onError(-2, e.getMessage());
> e.printStackTrace();
> } catch (OAuthExpectationFailedException e) {
> b.putInt(AccountManager.KEY_ERROR_CODE, -3);
> b.putString(AccountManager.KEY_ERROR_MESSAGE,
> e.getMessage());
> mResponse.onError(-3, e.getMessage());
> e.printStackTrace();
> } catch (OAuthCommunicationException e) {
> b.putInt(AccountManager.KEY_ERROR_CODE, -4);
> b.putString(AccountManager.KEY_ERROR_MESSAGE,
> e.getMessage());
> mResponse.onError(-4, e.getMessage());
> e.printStackTrace();
> }
> setAccountAuthenticatorResult(b);
> finish();
> }
>
> And here is the short stack trace I get when I try to addAccount from
> my Activity, rather than through the Accounts & Sync page:
>
> W/System.err( 264): android.accounts.AuthenticatorException: bind
> failure
> W/System.err( 264): at
> android.accounts.AccountManager.convertErrorToExcepti
> on(AccountManager.java:1096)
> W/System.err( 264): at android.accounts.AccountManager.access$500
> (AccountMan
> ager.java:74)
> W/System.err( 264): at android.accounts.AccountManager$AmsTask
> $Response.onEr
> ror(AccountManager.java:944)
> W/System.err( 264): at android.accounts.IAccountManagerResponse
> $Stub.onTrans
> act(IAccountManagerResponse.java:69)
> W/System.err( 264): at android.os.Binder.execTransact(Binder.java:
> 287)
> W/System.err( 264): at dalvik.system.NativeStart.run(Native
> Method)
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en