2013-09-27 5 views
0

내 앱이 설치되면 사용자 메일 계정 목록을 표시하고 싶습니다. 예 : 내 모바일에 3 개의 계정이 있고, 앱 설치시 3 개의 계정이 표시됩니다. 어떻게 사용자 등록 계정을 얻을 수 있습니까? ? 모든 자습서 또는 링크를 사용하는 것이 좋습니다.사용자 등록 메일 계정 목록을 Android에서 가져 오는 방법은 무엇입니까?

+0

우수 설명이 발견 될 수있다 [여기서] [1] [1] : http://stackoverflow.com/a/2175688/ 여기

제가 사용 방법 1696704 –

+0

여기에서 얻을 수 있습니다. http://www.demoadda.com/demo/android/getregistered-email-account-from-device_96 – Kishan

답변

1

AccountManager를 사용하여 입력 된 Gmail 주소를 검색 할 수도 있습니다.

private String getFirstAccount() { 
     Pattern emailPattern = Patterns.EMAIL_ADDRESS; // API level 8+ 
     Account[] accounts = AccountManager.get(Compte.this).getAccounts(); 
     for (Account account : accounts) { 
      if (emailPattern.matcher(account.name).matches()) { 
       String possibleEmail = account.name; 
       return possibleEmail; 
      } 
     } 
     return null; 
    } 
관련 문제