tags:

views:

678

answers:

3

I'm writing a program that should display the amount of unread sms, mms, phone calls and emails. It was quite easy to find how to query for sms and phone calls (I used the search on this page) but I have not been able to find out how to query for emails.

Is there anyway to find out how many unread emails the user got in their phone?

A: 

Unfortunately that is going to be difficult because you don't know which application(s) the user uses for eMail and there is no shared database or provider.

I suggest you make a list of the most popular eMail apps, implement the counter separately and add the numbers.

I'm guessing Google's GMail and EMail apps are amongst the most popular and I've used Nitroid's Touchdown before EMail had exchange support.

Josef
BenIOs
Josef
You could be right. I found this for Gmail "content://gmail-ls/" that a few have asked for before. But I haven't found any post describing a working way. I'll keep looking..
BenIOs
A: 

According to a thread on the android developer list which I found by searching for "unread email count" , the Gmail.java file which you can find in gmail4j (found through Google Code search) gives the provider you need. That's what the author of gmail-unread-count did.

Sorry, I don't yet have enough rep to link to the thread & the app, so I'm just linking to the code.

Cheers, Dave.

Dave Neary
Yes that is one solution but I would prefer to query the data that is already saved on the phone instead of downloading it from the net.
BenIOs
+1  A: 

I'm the author of Gmail Unread Count. Check out Gmail.java, it's what I use. There are a couple of ways to do it. I read the unread count directly from the label. You should be able to figure out how to use it by reading the source.

Getting the unread count from Email is afaik not possible so you'll have to do polling there.

alexanderblom