deltachat-android icon indicating copy to clipboard operation
deltachat-android copied to clipboard

Notifications don't always appear when running multiple instances of DeltaChat

Open rrthomas opened this issue 2 years ago • 5 comments

  • Android version: 9
  • Device: Sony XZ1 Compact
  • Delta Chat version: 1.28.3
  • Expected behavior: I should always get notifications for new messages
  • Actual behavior: I sometimes get notifications for new messages
  • Steps to reproduce the problem: Run DeltaChat on multiple devices
  • Screenshots: n/a
  • Logs: n/a

I am running DeltaChat 1.26.0 for Ubuntu on two other machines, at least one of which is on 24/7. If I quit them, the notifications are reliable, but with them running, my phone gets notifications for some messages but not others. All the messages are received and displayed correctly.

Thanks for DeltaChat!

rrthomas avatar Mar 15 '22 18:03 rrthomas

I started using Delta Chat in late February. Notifications were reliable until about the time this ticket was opened. In fact, previously, Android wouldn't dismiss notifications that desktop had read.

I've got Delta Chat running on my desktop (sometimes Linux, sometimes Windows) and my Android phone. Delta Chat is usually in the background.

spiffytech avatar Mar 24 '22 21:03 spiffytech

  • Mabye you have "Automatic Moves to DeltaChat folder" turned on on one device but turned off on the other?
  • Can you send a message to your account and if the bug happened then post logs here from both devices? If the bug didn't happen (and the notification was shown on both devices), try again instead. Ask back if you don't know how to get logs.

Hocuri avatar Mar 30 '22 13:03 Hocuri

Both devices have "Move to folder" enabled, and I also have a server-side rule to move DeltaChat messages to the folder (which worked fine until around March 15).

What seems to happen is the Android notification might flash for half a second, but is immediately cleared. Sometimes this happens too quickly for me to get the notification sound / visual / watch alert, and sometimes I get alerted that something came in, but the notification disappears before I can check it.

Here's the log file from when this happened a few minutes ago:

deltachat-log-20220330-092451.txt

spiffytech avatar Mar 30 '22 13:03 spiffytech

What seems to happen is the Android notification might flash for half a second, but is immediately cleared. Sometimes this happens too quickly for me to get the notification sound / visual / watch alert, and sometimes I get alerted that something came in, but the notification disappears before I can check it.

@spiffytech I can reproduce that when the app runs on my Desktop PC and the chat view for a certain contact is open there. I run Delta Chat on Android as well at the same time. Now, when this chat contact sends a message to me, it is automatically read on my Desktop because the view there is still open. Within a second, the Android client is about to "make noise", but right after the Desktop instance has marked the message as read, the notification on Android disappears instantly. To prevent such situations, no chat in the Desktop app must be opened/focused, otherwise these messages are read and return receipts are sent back automatically, probably at times when the message recipient is still asleep, but Delta Chat "lies" and tells otherwise. ;-)

gerryfrancis avatar May 04 '22 10:05 gerryfrancis

Me too, I can reproduce the problem: When DC-Desktop (1.30.1) is running then then the mobile clients don't show any notifications. Closing the DC-Desktop and Notifications work again.

  • DC on mobile is 1.30.3
  • The Desktop app had not focus when notifications vanish
  • But the Desktop app has an open Window (in i3wm) on a 2nd Monitor

cehteh avatar Jul 15 '22 13:07 cehteh

@cehteh Could you try again with new DC versions?

ghost avatar Feb 05 '23 19:02 ghost

Meanwhile i have a new smartphone (Fairphone4 with Calyxos/microg, no google).

Testing with following DC Clients running:

a) DC-Desktop 1.30.1 (yes I should update that) on Debian b) DC-Android 1.34.10 on the Fairphone c) DC-Android (some older version) on my old phone/LineageOS in another room

Sending a message to me from my wifes phone:

(a) doesn't show a notification (but that might be because of my uncommon no-desktop setup. (b) shows a notifcation when the display is active, which instantly disappears (nothing shown in the notification view when swiping down) it also makes the incoming message sound. (c) had no message notifcations showing up

I did the tests with different combinations of app/window in focus between (a) and (b). The outcome is the same, except that on (b) nothing is displayed when the display is off, but a notification sound is played once (still no trace left of the notification when one unlocks the phone an looks at the notification view).

Messages are all received and when the chat isn't in foreground its tagged with a green dot.

cehteh avatar Feb 09 '23 12:02 cehteh

@cehteh Please read my comment written mid of 2022 and report back, thanks! :)

gerryfrancis avatar Feb 09 '23 15:02 gerryfrancis

@cehteh Please read my comment written mid of 2022 and report back, thanks! :)

@r10s @gerryfrancis yes i can confirm that, exactly that is happening here too, when I quit the desktop app then notifications on android are permanent.

cehteh avatar Feb 09 '23 17:02 cehteh

@cehteh Please read my comment written mid of 2022 and report back, thanks! :)

@r10s @gerryfrancis yes i can confirm that, exactly that is happening here too, when I quit the desktop app then notifications on android are permanent.

I updated desktop to 1.34.3, problem still exists.

edit Problem is solved! I had desktop having focus, that cleared the notification in android, without focus the notification stays active 🎉

edit2 ... but now the tray icon on the desktop is gone, i'll investigate further

cehteh avatar Feb 09 '23 17:02 cehteh

Sometimes when a respective chat is still opened (selected) in Delta Chat on Desktop, new corresponding emails will be marked as read before - in my case - the Android client sees them. Notifications in Delta Chat usually are generated for unread messages, not for read ones...

gerryfrancis avatar Feb 09 '23 21:02 gerryfrancis

We cant track users eyes/minds but we should have some decently reliable logic about what constitutes as 'message read'.

Just a chat being in focus is not enough. Something like the chat is getting focus after the user got a notification or the user interacted with this client within the last 30 seconds and it is still in focus may be good.

Then all clients may have a small cooldown (like 5 secs) before they present a audible notification. This gives other clients (see above) a chance to mark messages as read and thus cancel notifications. A silent notification can still be presented instantly upon message receive.

The current situation is that all active clients give some audible notification instantly which may immediately become canceled because one of the client decides that the message got read. picking up the phone that just pined and just discover that is has no pending messages anymore is a bit ugly.

cehteh avatar Feb 10 '23 09:02 cehteh

@cehteh I cannot reproduce the issue with Delta Chat for Desktop version 1.34.4 anymore. Could you check and report back, too, please? You can download the new version from here: https://download.delta.chat/desktop/v1.34.4/

gerryfrancis avatar Feb 10 '23 10:02 gerryfrancis

Since this might be fixed, I'm going to close this for now without re-reading the whole discussion. We can always re-open it. Also, there are lots of messages in here, so it would probably be better to just open a new issue with a summary (we won't run out of numbers for our issues soon, so it's often good to just open a new issue instead of re-using an old one).

Hocuri avatar Feb 20 '23 17:02 Hocuri