I would like to add a gmail account in the device thro code.Is there any possibilites for it or I have to do it manually.Thanks..
Asked
Active
Viewed 1,305 times
0
-
1Check this answer: [Add account automatically](http://stackoverflow.com/questions/7664987/add-account-automatically) – Paresh Mayani Nov 15 '11 at 07:44
-
1Thanks a lot Paresh...I will work on it.... – Karthik Nov 15 '11 at 07:47
-
I have given my Package inside,and to the app is crashing.I have added the required permissions also in the manifest.com.notify is my package name.Do I need to add anything else to it. `Account account = new Account("frewer.rtg@gmail.com", "com.notify"); String password = "qwegtgr234"; AccountManager accountManager = AccountManager.get(context); accountManager.addAccountExplicitly(account, password, null);` – Karthik Nov 15 '11 at 09:00
-
Please add code through the [edit] button, not in comments. Code in comments is nearly unreadable. – sarnold Jan 21 '12 at 02:05
-
@user1204089 The answer added by Paresh Mayani in the above code is the right answer just try it...it works.. – Karthik Sep 12 '12 at 02:56
-
1Thanks for response! I used that code with new account("my id@gmail.com", "my package name here which is 'com.example.addaccount' ") and I added authenticator.xml file in a folder named xml, with same package name android:accountType="com.example.addaccount". But I am getting error "caller uid 10043 is different than the authenticator's uid". Can you please tell me, what am I missing? I just added the xml file and wrote that code to add account, do I need to refer to that xml some how? – blackfyre Sep 12 '12 at 06:29
-
@user1204089 i also want to add a Google account through code, so will u provide a simple example from your experience? i hope u will... – Prabhu Jul 10 '14 at 05:35