java - Creating a google account on android programatically (non-rooted device) -
i need create (or associate) google account on android device. have enabled usb-debugging, , able run commands through adb (usb-debugging enabled). have tried several approaches , searched, have not been able come solution.
i know able delete google account permission manage_accounts, 1 of reasons why need able automatically add account. when using addaccountexplicitly namespace com.google, gives me error "java.lang.securityexception: caller uid 10165 different authenticator's uid" described in android developer documentation.
cheers
you can try using accountmanager addaccount method.
accountmanager accountmgr = accountmanager.get(mcontext); accountmgr.addaccount("com.google", "auth_token_type", null, new bundle(), (activity) mcontext, null, null);
for auth token type may able use "oauth2:https://mail.google.com/"
alternatively, can use native device add account intent doing
startactivity(new intent(settings.action_add_account));
Comments
Post a Comment