Search This Blog

Saturday, March 12, 2016

Android - access gmail account - less secure app

the app i devlop needed to access gmail account to send and read emails.
i need to set my gmail account to allow access to less secure app.
e.g. https://www.google.com/settings/security/lesssecureapps

google change the security issue as you can read here
https://security.googleblog.com/2014/04/new-security-measures-will-affect-older.html

to allow access to gmail account without any "less secure " prompt issue, you might need to use OAUTH2 access to imap & SMTP.
to do that use , javamail 1.5.5 from
https://java.net/projects/javamail/pages/Android.

sample code could be found here
https://github.com/darrenjl/EmailYourself/blob/master/android/EmailYourself/src/me/darrenlyons/emailyourself/email/GmailSender.java

and here OAuth flow using the AccountManager on Android


from Android SDK Authenticating to OAuth2 Services

NEW 03-2019

Java Mail API Using GMAIL OAuth API In Android