Android - Java mail - Gmail 'Mark as unread' & Inbox 'Snooze'

386 views Asked by At

My homemade Android email client app, using Java mail, works fine with google mail service.

One use case for which I would like some piece of advice does concern the 'unread messages':

Whenever I 'Mark as unread' an email in mail.google.com, my mobile app update the email as 'unread' accordingly. Good.

Now I am using inbox.google.com and the 'Mark as unread' option is not present anymore.

As explained on the How Inbox works with Gmail page from Google, some actions are identical and other are similar.

About 'Mark As Unread' feature, it is not present anymore in 'Inbox'.
Instead, a 'snooze' option is replacing it:

In GMail (mail.google.com): 'Mark as Unread'
In Inbox (inbox.google.com): 'Snooze' (NOT identical to 'Mark as unread', but has 'similar' behavior)

Question:

How can I figure out, in my android java code, that a message is 'snoozed'?
I googled for it and checked GMail's extensions but could not find an answer.

Note:
I also checked Imap messages userFlags and systemFlags: nothing there :/

Thanks.

1

There are 1 answers

1
medmunds On

It looks like a lot of Inbox's features are implemented as a special kind of label: one that you can search for, but not one that appears as an actual Label or any sort of metadata in the Gmail API (or IMAP).

Try this (if you're an Inbox-by-Gmail user): open the Gmail web client, and enter label:snoozed in the search box. It should find all your snoozed messages. Also works for label:pinned, label:done, label:trips and label:purchases (Inbox smart bundles), label:lowpriority, etc. (Also try creating a new label with any of those names: they're all "reserved for system use.")

Even though they don't appear in the Gmail labels.list API, you can use these special Inbox label searches with the q (query) parameter in threads.list and messages.list.

So to figure out if a message is snoozed from your code, see if its message id appears in messages.list called with q=label:snoozed.

I don't see any way to add or remove these special Inbox labels on a message through the API, unless/until Google exposes them like other labels. (FWIW, the special Gmail Categories do appear in the API, e.g., "Updates" is a system label with id CATEGORY_UPDATES. So maybe there's hope things like "snoozed" make it into the API, too, as those Inbox features find their way into Gmail.)