I think I might have found an issue with using AccountManager in
Android 2.x devices. I have 2 apps in the market that use Google
Reader: Reader Widget Pro and Reader Widget Free. I was updating them
both to use AccountManager and the new authentication method. I
noticed that on my Nexus One when one application (say the Free one)
obtained a token using AccountManager.getAuthToken() with the service
set to "reader" the other app (say the Pro one) was unable to obtain a
token afterwards. Even using AccountManager.invalidateAuthToken() in
the first app did not work. Sample code:
AccountManagerFuture<Bundle> accFut =
accountManager.getAuthToken(acct, "reader", false, null, null);
try {
if(accFut != null && accFut.getResult() != null){
Bundle bundle = accFut.getResult();
authToken = bundle.getString("authtoken"); // This key is no
longer
in the bundle for the 2nd app
Log.e(TAG, "accFut null");
}
} catch (OperationCanceledException e) {
e.printStackTrace();
} catch (AuthenticatorException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
I don't know if this is supposed to happen. It could mean big problems
if several apps are trying to get auth tokens for the same service on
the same phone. One application could prevent others from working. I
will stick to the old GoogleLoginServiceBlockingHelper method in my
apps for now. Anyone else noticed this issue?
--
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