I am developing an application which requires to auto populate a default email field. The logical choice is to retrieve the email address from the email client provided by android. I sear开发者_Go百科ched the content providers and did not find anything about the email client. How is this information stored? How can I reach it?
Try this:
AccountManager accManager = AccountManager.get(context);
Account acc[] = accManager.getAccounts();
int accCount = acc.length;
AppConstants.accOnDevice = new Vector<String>();
for(int i = 0; i < accCount; i++){
//Do your task here...
}
Permission:
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
精彩评论