Push notifications not working with chatmail server

I am using an account I created in the nine.testrun.org chatmail server on an android device and I can not get push notifications working. Since Google notifications work with other apps I use, I do not think this is my phone’s fault…
If someone can give me some advice why this is not working, I’ll so grateful!

Have a nice day,

Could you add more details?

Which phone do you use, which Android version it has?

Which version of Delta Chat do you have installed, is it installed from Google Play or F-Droid? F-Droid does not have support for FCM push notifications because of non-free Google libraries.

What does the log say? Does it contain “push-enabled=true” and “push-token”?
Try sending a message to self from another account, there should be a log line “FcmReceiveService: FCM push notification received”.

Does it fail to deliver notifications only on one network? Can you try switching to another internet connection, e.g. between Wi-Fi and LTE?

In the notification settings, do you have “Use Background Connection” and/or “Force Background Connection” settings enabled?

2 Likes

I have only managed to reproduce the problem by force stopping the app. Then I get errors like this:

09-05 xx:yy:zz.000 11111 11111 W GCM     : broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=chat.delta (has extras) }

This is however expected for force stopped apps as described here:

Note that Delta Chat for Android only shows notifications when it manages to download some message from IMAP server. If FCM notification is received but connection to IMAP server fails, you will not receive a notification. For example if you configure SOCKS proxy inside Delta Chat and the proxy is not working at the moment, FCM notification will be received as Google services do not use the proxy, “FcmReceiveService: FCM push notification received” will be logged, but no notification will be displayed.

I also found a similar catch-all issue for Signal:

Signal likely uses a similar architecture: notification is only displayed if fetching actual message over WebSocket connection to Signal servers succeed.

Hey!
Thanks for the complete answer!
As you said on one of the questions, I downloaded the app from F-Droid and didn’t think of that, but it makes sense :sweat_smile: Sorry for that…
Maybe this could be a good think to add on the notifications section of the FAQ, since a lot of FOSS enthusiasts download it from there!

However, I’ve been testing with both “Use background connection” and “Force background connection” enabled, and it doesn’t work as good as I would need for everyday use. I’ve disabled all battery optimizations for the app following dontkillmyapp.com and hid the permanent notification for convenience. It works well a while after I open the app, but after a couple of ours or so, it just stops the background connection and I have to open the app again. I suppose it is a battery optimization thing, but I’m not sure (I disabled battery optimization).
I’m using a Xiaomi Redmi 7 with the last update from the stock android (MIUI Global 11.0.2, Android 10).
Is this behavior expected or known?

Thank you,

You can try enabling permanent notification and then hiding it with OS by long-pressing it and selecting some option.

Another common problem is that even though FCM manages to start the app and it logs “FcmReceiveService: FCM push notification received”, it then fails to connect to IMAP and resolve DNS, logging something like “DNS resolution for … failed: DNS lookup failure: failed to lookup address information: No address associated with hostname.”
This happens at least on some stock Samsung phones.

What can probably done in this case is that if Delta Chat gets FCM notification but fails to connect, it can show a notification saying “Failed to connect” if connectivity status is “not connected” (DC_CONNECTIVITY_NOT_CONNECTED) so user can try to open the app. This will at least make this situation visible instead of silently failing.

I wrote an issue on GitHub about this: Add option to show notification if we cannot connect after receiving FCM notification · Issue #3281 · deltachat/deltachat-android · GitHub

1 Like

What may also help is going through https://support.signal.org/hc/en-us/articles/360007318711-Troubleshooting-Notifications and checking the settings listed there per Android version.

Here is a beta version of Delta Chat 1.46.15 for Android:

It has new “foreground service” started when notification is received besides new proxy settings.

If you have as Android phone which has trouble receiving notifications, please test if this version is better at receiving notifications.

It is not a final release version so it displays annoying “Not connected”/“Connecting…” status each time a notification is received, this will be fixed before proper even version number non-beta release. The most important part to test is that you get message notifications in background when you previously got no message notification at all.

3 Likes

I’ve done some tests and seems to work pretty well, better than the older version, for sure!
I think I’ve reached a great balance now between usability and notification receiving.

Thank you really much for your help!

Connection/disconnection when receiving FCM in foreground is going to be fixed soon as well, it is already in the nightly builds: Reuse existing connections in `background_fetch` by link2xt · Pull Request #6024 · deltachat/deltachat-core-rust · GitHub

1 Like