0

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.

Pascal
  • 15,257
  • 2
  • 52
  • 65
  • Have you tried using JavaMail to dump out the headers and message flags for a snoozed message? – Bill Shannon Feb 17 '18 at 00:19
  • @BillShannon I did not see any differences in flags. I'll check again to be 100% sure. – Pascal Feb 19 '18 at 05:46
  • @BillShannon FYI, I also checked message systemFlags and userFlags, but nothing about 'snoozed' messages (cfr [user Flags from message](https://stackoverflow.com/questions/19158152/how-to-remove-user-flags-from-message)] – Pascal Mar 12 '18 at 13:09
  • If you have two devices running Inbox, does snoozing on one appear as snoozed on the other? Is the snoozing state held in the client or the server? It's also possible that Inbox is using the Gmail proprietary protocol instead of IMAP to access the messages on the server. That protocol might have a way to save the snoozing state that's not visible through IMAP. – Bill Shannon Mar 12 '18 at 19:57
  • Answers to your questions are here: https://support.google.com/inbox/answer/6067583?hl=en . I think I will not be able to use the snooze feature using JavaMail. – Pascal Mar 13 '18 at 07:09
  • That doesn't really tell you how it's implemented and so doesn't answer any of my questions. – Bill Shannon Mar 13 '18 at 17:36
  • 'Snoozed messages' appear and can be changed on any devices (Computer, Android, iPhone & iPad) as per the page I mentioned. Implicit consequence is that they are not stored locally only, but synced with server and shared among devices. I just checked (computer & Android phone): that's the case. Maybe an IMAP extension, or, more likely, a Google proprietary thing as you mentioned. Thanks for your contribution on this. – Pascal Mar 14 '18 at 13:17
  • If you ever figure out how this works, I'd love to know too! – Bill Shannon Mar 14 '18 at 19:18
  • I just decompiled Google's inbox app, but this is really not clear : Google team obfuscated it so well, that it would take way too much time for me to find out. If I ever find the answer, I'll keep you posted. – Pascal Mar 15 '18 at 06:05

1 Answers1

2

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.)

medmunds
  • 5,950
  • 3
  • 28
  • 51