newChooseAccountIntent force open dialog in android 6.0

219 views Asked by At

I use this function for account chose and pick get user's email.

    private void pickUserAccount() {

        String[] accountTypes = new String[]{"com.google"}; 

        try { // request account

            Intent intent = AccountPicker
                    .newChooseAccountIntent(null, null, accountTypes, false, null, null, null, null);

            startActivityForResult(intent, AuthProcess.REQUEST_CODE_PICK_ACCOUNT);

/*
        Error control

*/

        } catch (CriticalException e) {

            throw e;

        } catch (OutOfMemoryError e) { // problems with memory    

            throw e;

        } catch (Throwable e) { // Other exceptions

            final String message = "Error during google account picker dialog: " + e;

            throw new CriticalException(logcat, message);

        } 

    } // End: pickUserAccount

In android 6.0 this code open dialog for chose account in spite of only one google account present at the device. In android 4.4.2 it work nice. What's the problem? Thank you.

0

There are 0 answers