androidandroid-account

How Can I Get email ids of Yahoo/Microsoft Account


Is it possible to get Yahoo/Microsoft email id/ ids which are configured with PlayStore app in android device. I use com.yahoo.mobile.client.share.sync for Yahoo. But Not Working .May I know what is the correct way to achieve my objective?

Here is my code:

public String[] allemails()
        {

             _accountMgr = AccountManager.get(getActivity());
               // Account [] accounts = _accountMgr.getAccounts();

              //  Account [] accounts = _accountMgr.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
             Account [] accounts = _accountMgr.getAccountsByType("com.yahoo.mobile.client.share.sync");

             numberOfEmail = accounts.length ;
                String [] emailAddress = new String[numberOfEmail];

                r = 0;
                for (Account account : accounts) {
                    accountsList = account.name.toString();
                    emailAddress[r] = accountsList;
                    r += 1;

                }

                MyAlertDialog f = new MyAlertDialog();
                Bundle args = new Bundle();
                args.putStringArray("Title", emailAddress);
                f.setArguments(args);

                return  emailAddress;
        }

Solution

  • Replace the account type

    com.yahoo.mobile.cllient.share.sync

    to

    com.yahoo.mobile.client.share.account