A couple of questions came up from the email auto-complete snippet.
Can you auto-complete all emails rather than just Google ones?
Yes. This version checks that account names are email addresses with a regular expression and puts them in a set to avoid duplicates. If you’re targeting API level 8 or above, there is even an email pattern in the Android framework. (You could also reverse the email check and use this code to auto-complete usernames.)
Thanks to Akshay Dashrath, Nick Butcher and Christopher Orr for suggesting those revisions.
Will users complain about the
Yes. A few probably will, but for the majority users who pay attention to permissions, it will come down to whether or not they trust your app with their accounts. If you add this permission just to improve your login screen UX then it’s something to consider. However, there are many other reasons to request the
GET_ACCOUNTS permission, such as storing tokens in the account manager or using Google Cloud Messaging.