ahsan
ahsan

Reputation: 677

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

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

Upvotes: 2

Views: 1380

Answers (2)

Vinayak Bevinakatti
Vinayak Bevinakatti

Reputation: 40503

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

Upvotes: 2

Sky Kelsey
Sky Kelsey

Reputation: 19290

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/

Upvotes: 2

Related Questions