Is there a way to get Gmail user account’s password by overcoming the SecurityException.
I am working on sending emails in the background without user prompt. The javamail API I used for this requires username and password of the account from which emails should be sent. I am finding trouble to get a Password using AccountManger in android.
Fortunately, no. The
ActivityManager.getPassword()call is only allowed to applications that have the same UID as the authenticator module (in this case Google applications). Even if you managed to call it though, it doesn’t store the actual password but an encrypted version of it, or a master token. You can find more details about how it works here: http://nelenkov.blogspot.jp/2012/11/android-online-account-management.htmlGoogle’s SMTP servers do support OAuth2 tokens in place of password though, so you can just get a token from
AccountManagerand use it to authenticate and send email. Details here:https://developers.google.com/google-apps/gmail/oauth_overview