开发者

how to know if the email client of Android has been setup or not?

开发者 https://www.devze.com 2023-04-06 05:17 出处:网络
I want to know, if its possible to check and see开发者_JAVA百科 if the android email client has been setup or not? Can anyone kindly help me out ? Thanks.I\'m assuming you don\'t actually want to send

I want to know, if its possible to check and see开发者_JAVA百科 if the android email client has been setup or not? Can anyone kindly help me out ? Thanks.


I'm assuming you don't actually want to send an email, and instead want to simply check. But if you are after the first one, then you can try this example:

http://snipplr.com/view/15639/


I tried the code available in the link mentioned by Sky, but it did not work for me. I implemented it as below.

public boolean isEmailSetup() {
        AccountManager am = AccountManager.get(HomeScreen.this);
        Account[] accounts = am.getAccounts();
        return accounts.length > 0;
    }

You need to specify the permisson <uses-permission android:name="android.permission.GET_ACCOUNTS"/> in you AndroidMenifest.xml

0

精彩评论

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