Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • get Added accounts email from device Android

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 177
    Comment on it

    Blow code get list of Emails account from AccountManager.

     AccountManager manager = (AccountManager) mActivity.getSystemService(mActivity.ACCOUNT_SERVICE); 
            Account[] list = manager.getAccounts();
            if (list.length > 0) {
                HashSet<String> emails = new HashSet<>();
                for (int i = 0; i < list.length; i++) {
                    if (isValidEmail(list[i].name)) {    
                        emails.add(list[i].name);
                    }
                } }  
    
    public static boolean isValidEmail(String email) {
            return android.util.Patterns.EMAIL&#95;ADDRESS.matcher(email).matches();
        }
    

    Permission Required:-

    <uses-permission android:name="android.permission.GET&#95;ACCOUNTS"/>  
    

    Happy Coding ;)

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: