开发者

How to get default email account information in android..?

开发者 https://www.devze.com 2023-04-12 11:33 出处:网络
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

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" />
0

精彩评论

暂无评论...
验证码 换一张
取 消