AccountManager.getAuthToken never returns

843 views Asked by At

I am trying to get the auth token for Google account, for the same I am using below code:

 AccountManager acoountManager = AccountManager.get( getContext( ) );
        AccountManagerFuture< Bundle > accountManagerFuture = acoountManager.getAuthToken( account, "android", null, (Activity) ctx, null, null );
        Bundle authTokenBundle = accountManagerFuture.getResult( );

It should return the auth token if my app have permission to access Google Account token else show a permission request screen.

My problem is, in some of the devices it never returns. Also I observed that it was working once I do factory reset to the same device. I am not able to understand why its not returning before without factory reset, was it missing any system service? Please help!!!

1

There are 1 answers

1
KR_Android On BEST ANSWER

I found my answer here, https://code.google.com/p/android/issues/detail?id=25473

This is a bug in android which is fixed in lollipop.