androidandroid-accountaccountpicker

Pick an email using AccountPicker.newChooseAccountIntent


I'm trying to let the user pick an Email account using the following code:

Intent intent = AccountPicker.newChooseAccountIntent(null, null, new String[]{"com.google"},
                            false, null, null, null, null);
                    startActivityForResult(intent, 23);

This code works great but if the user doesn't have a Gmail account but Yahoo, Hotmail, etc.. How can I show all Email accounts by changing the third parameter:

new String[]{"com.google"}

Thank you very much


Solution

  • It's 2019, and the code does not seem to work anymore. To get all accounts shown in the picker (using Xamarin Android), instead of

    Android.Gms.Common.AccountPicker.NewChooseAccountIntent(null, null, 
    null, false, null, null, null, null);
    

    you have to use

    Android.Accounts.AccountManager.NewChooseAccountIntent(null,null,null,null,null,null,null)