1

I am using following code to add account into Account list

final AccountManager accountMgr = AccountManager.get(this.getApplicationContext());
 Account ac = new Account("my.id","com.google");
try{
      accountMgr.addAccountExplicitly(ac, "password", null);}
catch(Exception e){
 String str = e.getLocalizedMessage();
 Log.e("err",str);
}

but getting following error everytime: 'caller uid 10066 is different than the authenticator's uid'

ANUP
  • 185
  • 1
  • 5
  • 14

1 Answers1

3

The following stackoverflow question seems to deal with the issue:

SecurityException: caller uid XXXX is different than the authenticator's uid

The article it links to ( http://loganandandy.tumblr.com/post/613041897/caller-uid-is-different ) explains the whole thing, though it took me a minute to realise what part of my code the last xml snippet was referring to.

I ended up storing my account type and auth token type in my strings.xml and referencing them in the authenticator.xml and code as needed.

Community
  • 1
  • 1
tzrlk
  • 848
  • 1
  • 13
  • 30
  • Good idea to store it just once and reference it from both places. – poolie Feb 05 '12 at 07:43
  • @Tzrlk can you please show some code on what you did? Thanks! – Mbrevda Oct 02 '12 at 15:20
  • 3
    So I'm still getting this crash even though I don't have the mismatch in my XML file. In fact, the crash occurs randomly on very few people's devices. Is this happening consistently for all of you? – b.lyte Jul 28 '14 at 19:50