Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not receiving notifications on the F-Droid version with unified push #3031

Open
K4LCIFER opened this issue Jun 13, 2024 · 54 comments
Open

Not receiving notifications on the F-Droid version with unified push #3031

K4LCIFER opened this issue Jun 13, 2024 · 54 comments
Assignees
Labels
A-Push O-Occasional Affects or can be seen by some users regularly or most users rarely S-Critical Prevents work, causes data loss and/or has no workaround T-Defect Something isn't working: bugs, crashes, hangs and other reported problems Z-UnifiedPush

Comments

@K4LCIFER
Copy link

Steps to reproduce

  1. Install unified push (e.g. ntfy.sh)
  2. Install Element X via F-Droid
  3. Receive a message
  4. Observe that no notification is received.

Outcome

What did you expect?

I would expect to receive a notification.

What happened instead?

I didn't receive a notification

Your phone model

Google Pixel 6

Operating system version

Android 14

Application version and app store

0.4.14

Homeserver

matrix.org

Will you send logs?

No

Are you willing to provide a PR?

No

@K4LCIFER K4LCIFER added the T-Defect Something isn't working: bugs, crashes, hangs and other reported problems label Jun 13, 2024
@bmarty bmarty self-assigned this Jun 14, 2024
@bmarty
Copy link
Member

bmarty commented Jun 14, 2024

Hello @K4LCIFER , thanks for reporting. For some reason, sometimes an error occurs when registering the pusher. I am investigating it.

To unblock you, can you navigate to Setting/Notifications then scroll to the bottom. If the current push provider is displayed and in Error, you can click on it and select again "Ntfy". It should help.

Also note that if your a matrix.org user, push may be rate limited by the ntfy server.

It's also possible to run the notification troubleshoot tests to see what could go wrong.

@K4LCIFER
Copy link
Author

K4LCIFER commented Jun 14, 2024

@bmarty: To unblock you, can you navigate to Setting/Notifications then scroll to the bottom. If the current push provider is displayed and in Error, you can click on it and select again "Ntfy". It should help.

I don't appear to have any push provider information on that page.
picture


@bmarty: Also note that if your a matrix.org user, push may be rate limited by the ntfy server.

I don't think that's the case here. I've received notifications from other services at higher rates through Ntfy than through Element.


@bmarty: It's also possible to run the notification troubleshoot tests to see what could go wrong.

It appears that there is no issue and it is able to find the UnifiedPush provider.
picture1


The issue is still persisting.

@alnmy
Copy link

alnmy commented Jun 17, 2024

Same issue, GrapheneOS with self-hosted ntfy.sh instance that has other notifications working but not from Element X. Also same results from the troubleshoot tests.

@alnmy
Copy link

alnmy commented Jun 17, 2024

Same issue, GrapheneOS with self-hosted ntfy.sh instance that has other notifications working but not from Element X. Also same results from the troubleshoot tests.

My issue has been resolved. Essentially, my push server was behind a VPN which my server could not access. I would consider it a bug that the notification troubleshooter reports the "test push loop back" as being completed, when the server could not do this.

@bmarty
Copy link
Member

bmarty commented Jun 17, 2024

The "Test Push loop back" test does not involve the Matrix homeserver. But yes, I agree that the communication homeserver -> push gateway is not covered by the troubleshoot tests, and this is annoying. This is the only part that is not covered.

This is discussed at matrix-org/matrix-spec-proposals#4078

@anytimesoon
Copy link

I'm also facing this. Element receives the notification, but element x does not. All the notification troubleshooting tests pass.

I'm running calyox os on a fair phone, and the latest version of element x from the playstore

@tomhanax
Copy link

tomhanax commented Jun 21, 2024

same problem here, using F-Droid version

@K4LCIFER
Copy link
Author

I hope that the severity of this issue is labelled rather high — it severely impacts the usability of the app.

@voidzero
Copy link

voidzero commented Jun 22, 2024

I've tried both the Play Store version of ntfy and the F-Droid version, both are not giving me notifications, except for when I use the troubleshoot notifications button in Element X, or when I use Firebase. Where is the issue?

Subscribing to a new topic on ntfy and posting to that with curl does give me notifications for that topic. Using the Fedilab Mastodon client with ntfy also does work.

@bmarty bmarty added S-Critical Prevents work, causes data loss and/or has no workaround O-Occasional Affects or can be seen by some users regularly or most users rarely A-Push Z-UnifiedPush labels Jun 26, 2024
@dessalines
Copy link

Can confirm that unifiedpush with ntfy is not working with the version on f-droid. ntfy correctly shows the topic, but nothing comes through.

I'm using the default server for ntfy.sh.

@gtdm
Copy link

gtdm commented Jul 6, 2024

I've tried switching to FluffyChat after noticing this issue but that client has the same issue. No notifications at all... so I guess it's related to ntfy (or it's default instance) and not Element X?

@K4LCIFER
Copy link
Author

K4LCIFER commented Jul 6, 2024

so I guess it's related to ntfy (or it's default instance)

If so, it would probably be the actual service and/or app and not the default instance as @alnmy mentioned that they have the problem (they self-host a ntfy instance).

@spaetz
Copy link

spaetz commented Jul 9, 2024

If so, it would probably be the actual service and/or app and not the default instance as @alnmy mentioned that they have the problem (they self-host a ntfy instance).

Nope, alnmy said 'Essentially, my push server was behind a VPN which my server could not access.'. So, they had a completely different problem. I am pretty sure the 'problem' is on the ntfy.sh side. Try a different ntfy server (eg https://ntfy.envs.net/ ) and see if that one works any better.

@anytimesoon
Copy link

anytimesoon commented Jul 9, 2024

In my case, we can rule out the ntfy server since the notifications come through for element, but not element x

Edit to clarify that the messages come through on element x, but I get no notification for it. When I open the app, I can see a green dot indicating that there is a new message in a conversation, but there was not system notification about it

@gtdm
Copy link

gtdm commented Jul 10, 2024

In my case, we can rule out the ntfy server since the notifications come through for element, but not element x

Are you sure that the notifications come through ntfy? I've never had to use UnifiedPush with the "old" Element app because it had a timer-based notification system under the hood.

Edit: I'd actually really like to get the timer-based notification system in Element X too. Would save me the hassle from having to use UnifiedPush/ntfy at all since no other app I use requires those.

@anytimesoon
Copy link

Definitely coming through ntfy. The battery drain from constant polling lead me to add ntfy to my stack.

That said, it's been a few days since I've had any dropped notifications at this point

@K4LCIFER
Copy link
Author

K4LCIFER commented Jul 10, 2024

[@anytimesoon] That said, it's been a few days since I've had any dropped notifications at this point

You're receiving notifications for Element X through Ntfy? I haven't received a single notification with Unified Push and Ntfy since I opened this issue. It also seems that I'm not receiving notifications on element-android with Ntfy.

@p1gp1g
Copy link

p1gp1g commented Jul 12, 2024

The "Test Push loop back" test does not involve the Matrix homeserver. But yes, I agree that the communication homeserver -> push gateway is not covered by the troubleshoot tests, and this is annoying. This is the only part that is not covered.

This is discussed at matrix-org/matrix-spec-proposals#4078

This exact issue is more related to matrix-org/matrix-spec-proposals#2821 (which has to be recreated)

@MatMaul
Copy link

MatMaul commented Jul 16, 2024

You should put Element X as Unrestricted regarding battery optimisation, and not Optimized which is the default.

This is because:

  • received push notif doesn't contain the payload since it's E2EE
  • Element X needs to fetch the encrypted content and decrypt it in the background
  • when an app is wake up by FCM, it is given special treatment by the OS and can access the network and do stuff in the background for a certain period of time
  • this is NOT the case for UP based push

TLDR, you need BOTH the push provider AND Element X to be unrestricted regarding battery optimisation.

@MatMaul
Copy link

MatMaul commented Jul 16, 2024

@bmarty: it may be useful to warn the user of that and propose to the user to open the optimisation battery screen directly, when an UP provider is used instead of FCM.

@K4LCIFER
Copy link
Author

I'm not sure that's the issue. I have "Allow background usage" enabled for both Element X and Ntfy, yet I am receiving no notifications.

@voidzero
Copy link

Yeah battery optimizations has nothing to do with it, it's the first thing I tried.

@bmarty
Copy link
Member

bmarty commented Jul 17, 2024

It can help to change the setting for battery optimisation when the application is in background, or even not running, but sometimes the Push are not received even when the application is in foreground, so screen on, with charger plugged in, fast Wi-Fi, etc.

@igor-cali
Copy link

igor-cali commented Aug 28, 2024

I experience this issue (Element X and ntfy installed from F-Droid).
Standard ntfy server used.

Here a portion of the log I gathered fom ntfy (the subscription is added by Element X on device boot if removed) while I run the self tests for notification in Element X:

1724845012899 2024-08-28 13:36:52.899 D NtfyWsConnection io.heckel.ntfy/<14-char alphanumeric code> (gid=3): Opening **https://io.heckel.ntfy/<14-char alphanumeric code>/ws?since=none** with listener ID 2 ...
1724845012912 2024-08-28 13:36:52.912 E NtfyWsConnection io.heckel.ntfy/<14-char alphanumeric code> (gid=3, lid=2): Connection failed (response is null): Unable to resolve host "io.heckel.ntfy": No address associated with hostname
Exception:
java.net.UnknownHostException: Unable to resolve host "io.heckel.ntfy": No address associated with hostname
  at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156)
  at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)

It looks like the address can't be resolved.

Let me know if additional info are needed.

@p1gp1g
Copy link

p1gp1g commented Aug 28, 2024

How did you end with ntfy trying to connect to "io.heckel.ntfy"? Wipe ntfy data and try again ?

@igor-cali
Copy link

How did you end with ntfy trying to connect to "io.heckel.ntfy"? Wipe ntfy data and try again ?

Even if I manually delete the subscription from ntfy, it is added again with the same address (I assume it is created by Element X at boot).

@p1gp1g
Copy link

p1gp1g commented Aug 28, 2024

Can you try to wipe ntfy data and try again ?

@igor-cali
Copy link

Can you try to wipe ntfy data and try again ?

Cleared the ntfy cache first, and reeboted... no improvement.
After wiping ntfy data and rebooting, it looks like this issue is fixed for me.
Thanks for the hint!

@p1gp1g
Copy link

p1gp1g commented Aug 28, 2024

Great. If you are sure you haven't touch anything regarding the server setup on ntfy android, can you open an issue on their repo to follow this issue ? To give more detail the issue is "ntfy tries to connect to https://io.heckel.ntfy/" and give the stacktrace you printed earlier.

@seankhl
Copy link

seankhl commented Oct 10, 2024

I'm not sure what the deal is with my app, but I can't get any notifications to appear in my Element X app when using ntfy (default server) + UnifiedPush. Even with the app in the foreground. I haven't received a single notification from Element X outside of the notification troubleshooter. Things I've done:

  • clear ntfy data + cache and reboot
  • clear element-x data + cache and reboot
  • set both ntfy and element-x to allow background usage as unrestricted
  • tested element (non x version) with UnifiedPush and it works, notifications come as expected
  • did the notification troubleshooting and everything passes
  • looked at the ntfy logs. Both element and element-x look have similar looking log info, e.g. both topics are present and the metadata all look correct

Would love to see this improved and am happy to help provide anything needed to contribute toward that.

@spaetz
Copy link

spaetz commented Oct 10, 2024

One more thing to try: Use another ntfy server, such as ntfy.schildi.chat to make sure you don't run into rate limitations on the ntfy.sh server side.

@seankhl
Copy link

seankhl commented Oct 11, 2024

I tried that server as well as https://ntfy.envs.net as suggested above, each for a full day with dozens of messages coming in direct chats and 1000+ messages coming in public group rooms (all settings for both group chats and direct chats set to "all messages" with no custom notification settings on any room). Still no notifications.

@ThisNekoGuy
Copy link

In my case, making no configuration changes with ntfy, I do get a test notification but the last two tests fail:

IMG_20241021_030646


Device: Google Pixel 8
Android Version: 14 (via GrapheneOS)

@caspervk
Copy link

@MatMaul in #3031 (comment):

You should put Element X as Unrestricted regarding battery optimisation, and not Optimized which is the default.

This is because:

* received push notif doesn't contain the payload since it's E2EE

* Element X needs to fetch the encrypted content and decrypt it in the background

* when an app is wake up by FCM, it is given special treatment by the OS and can access the network and do stuff in the background for a certain period of time

* this is NOT the case for UP based push

TLDR, you need BOTH the push provider AND Element X to be unrestricted regarding battery optimisation.

This seems to be the answer!

During doze, the notification is properly received through UnifiedPush (ntfy-sh) and passed to Element X, but Element seems to be unable to retrieve the actual notification from the server (adb logcat | grep -E "ActivityManager|Ntfy|$(adb shell pidof -s io.element.android.x)" + Element X logs):

10-22 19:38:17.773 12559  3824 D NtfyWsConnection: ntfy-sh.example.org/uphunter2 (gid=1, lid=6): Received message: {"id":"asd123","time":1729618697,"expires":1729661897,"event":"message","topic":"uphunter2","message":"{\"notification\":{\"counts\":{\"unread\":1},\"devices\":[{\"app_id\":\"im.vector.app.android\",\"data\":{\"default_payload\":{\"cs\":\"203b48bd-5c79-46d2-a343-c1151b8ff535\"},\"format\":\"event_id_only\"},\"pushkey\":\"https://ntfy-sh.example.org/uphunter2?up=1\",\"pushkey_ts\":1729618509}],\"event_id\":\"$Cocha3ohqu2oos1nui3uong7huuyaele\",\"prio\":\"high\",\"room_id\":\"!iFo6ohthua7Aesab:matrix.org\"}}"}
10-22 19:38:17.786 12559  3824 D NtfySubscriberService: [https://ntfy-sh.example.org/uphunter2] Received notification: Notification(id=asd123, subscriptionId=34053450, timestamp=1729618697, title=, message={"notification":{"counts":{"unread":1},"devices":[{"app_id":"im.vector.app.android","data":{"default_payload":{"cs":"203b48bd-5c79-46d2-a343-c1151b8ff535"},"format":"event_id_only"},"pushkey":"https://ntfy-sh.example.org/uphunter2?up=1","pushkey_ts":1729618509}],"event_id":"$Cocha3ohqu2oos1nui3uong7huuyaele","prio":"high","room_id":"!iFo6ohthua7Aesab:matrix.org"}}, encoding=, notificationId=1547116709, priority=3, tags=, click=, icon=null, actions=null, attachment=null, deleted=false)
10-22 19:38:17.790 12559 14972 D NtfySubscriberService: [https://ntfy-sh.example.org/uphunter2] Dispatching notification Notification(id=asd123, subscriptionId=34053450, timestamp=1729618697, title=, message={"notification":{"counts":{"unread":1},"devices":[{"app_id":"im.vector.app.android","data":{"default_payload":{"cs":"203b48bd-5c79-46d2-a343-c1151b8ff535"},"format":"event_id_only"},"pushkey":"https://ntfy-sh.example.org/uphunter2?up=1","pushkey_ts":1729618509}],"event_id":"$Cocha3ohqu2oos1nui3uong7huuyaele","prio":"high","room_id":"!iFo6ohthua7Aesab:matrix.org"}}, encoding=, notificationId=1547116709, priority=3, tags=, click=, icon=null, actions=null, attachment=null, deleted=false)
10-22 19:38:17.790 12559 14972 D NtfyNotifDispatch: Dispatching Notification(id=asd123, subscriptionId=34053450, timestamp=1729618697, title=, message={"notification":{"counts":{"unread":1},"devices":[{"app_id":"im.vector.app.android","data":{"default_payload":{"cs":"203b48bd-5c79-46d2-a343-c1151b8ff535"},"format":"event_id_only"},"pushkey":"https://ntfy-sh.example.org/uphunter2?up=1","pushkey_ts":1729618509}],"event_id":"$Cocha3ohqu2oos1nui3uong7huuyaele","prio":"high","room_id":"!iFo6ohthua7Aesab:matrix.org"}}, encoding=, notificationId=1547116709, priority=3, tags=, click=, icon=null, actions=null, attachment=null, deleted=false) for subscription Subscription(id=34053450, baseUrl=https://ntfy-sh.example.org, topic=uphunter2, instant=true, mutedUntil=0, minPriority=0, autoDelete=-1, insistent=-1, lastNotificationId=DIKcW8ZVBWSI, icon=null, upAppId=io.element.android.x, upConnectorToken=91a1b80e-29ff-4afd-b060-b08766afaab4, displayName=null, dedicatedChannels=false, totalCount=446, newCount=446, lastActive=1729618616, state=CONNECTED)
10-22 19:38:17.791 12559 14972 D NtfyUpDistributor: Sending MESSAGE to io.element.android.x (token=91a1b80e-29ff-4afd-b060-b08766afaab4): 382 bytes
10-22 19:38:17.799  1516  1740 D ActivityManager: sync unfroze 25342 io.element.android.x for 3

2024-10-22T17:38:17.825271Z DEBUG elementx: [Push/VectorUnifiedPushMessagingReceiver] New message | 
2024-10-22T17:38:17.835299Z DEBUG elementx: [Push/PushHandler] ## handling pushData: !iFo6ohthua7Aesab:matrix.org/$Cocha3ohqu2oos1nui3uong7huuyaele | 
2024-10-22T17:38:17.851021Z DEBUG elementx: [Push/PushHandler] ## handleInternal() | 
2024-10-22T17:38:17.866613Z DEBUG matrix_sdk::http_client::native: Sending request num_attempt=1 | crates/matrix-sdk/src/http_client/native.rs:55 | spans: get_notification{room_id="!iFo6ohthua7Aesab:matrix.org" event_id="$Cocha3ohqu2oos1nui3uong7huuyaele"} > try_sliding_sync > sync_once > send{server_versions=[V1_0, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 4s } request_id="REQ-22" method=POST uri="https://synapse.example.com/_matrix/client/unstable/org.matrix.simplified_msc3575/sync" request_size="653 B"}
2024-10-22T17:38:17.873655Z DEBUG matrix_sdk::http_client: Error while sending request: Reqwest(reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("synapse.example.com")), port: None, path: "/_matrix/client/unstable/org.matrix.simplified_msc3575/sync", query: Some("timeout=1000"), fragment: None }, source: hyper_util::client::legacy::Error(Connect, ConnectError("dns error", Custom { kind: Uncategorized, error: "failed to lookup address information: No address associated with hostname" })) }) | crates/matrix-sdk/src/http_client/mod.rs:228 | spans: get_notification{room_id="!iFo6ohthua7Aesab:matrix.org" event_id="$Cocha3ohqu2oos1nui3uong7huuyaele"} > try_sliding_sync > sync_once > send{server_versions=[V1_0, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 4s } request_id="REQ-22" method=POST uri="https://synapse.example.com/_matrix/client/unstable/org.matrix.simplified_msc3575/sync" request_size="653 B"}
2024-10-22T17:38:17.874665Z  INFO matrix_sdk_ui::notification_client: fetching notification event with a /context query | crates/matrix-sdk-ui/src/notification_client.rs:540 | spans: get_notification{room_id="!iFo6ohthua7Aesab:matrix.org" event_id="$Cocha3ohqu2oos1nui3uong7huuyaele"}
2024-10-22T17:38:17.875378Z DEBUG matrix_sdk::http_client::native: Sending request num_attempt=1 | crates/matrix-sdk/src/http_client/native.rs:55 | spans: get_notification{room_id="!iFo6ohthua7Aesab:matrix.org" event_id="$Cocha3ohqu2oos1nui3uong7huuyaele"} > send{server_versions=[V1_0, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 30s } request_id="REQ-23" method=GET uri="https://synapse.example.com/_matrix/client/v3/rooms/!iFo6ohthua7Aesab:matrix.org/context/$Cocha3ohqu2oos1nui3uong7huuyaele"}
2024-10-22T17:38:17.879637Z DEBUG matrix_sdk::http_client: Error while sending request: Reqwest(reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("synapse.example.com")), port: None, path: "/_matrix/client/v3/rooms/!iFo6ohthua7Aesab:matrix.org/context/$Cocha3ohqu2oos1nui3uong7huuyaele", query: Some("limit=0&filter=%7B%22lazy_load_members%22%3Atrue%7D"), fragment: None }, source: hyper_util::client::legacy::Error(Connect, ConnectError("dns error", Custom { kind: Uncategorized, error: "failed to lookup address information: No address associated with hostname" })) }) | crates/matrix-sdk/src/http_client/mod.rs:228 | spans: get_notification{room_id="!iFo6ohthua7Aesab:matrix.org" event_id="$Cocha3ohqu2oos1nui3uong7huuyaele"} > send{server_versions=[V1_0, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 30s } request_id="REQ-23" method=GET uri="https://synapse.example.com/_matrix/client/v3/rooms/!iFo6ohthua7Aesab:matrix.org/context/$Cocha3ohqu2oos1nui3uong7huuyaele"}
2024-10-22T17:38:17.889868Z ERROR elementx: [Push/Notification/DefaultNotifiableEventResolver] Unable to resolve event: $Cocha3ohqu2oos1nui3uong7huuyaele.
org.matrix.rustcomponents.sdk.ClientException$Generic: msg=error sending request for url (https://synapse.example.com/_matrix/client/v3/rooms/!iFo6ohthua7Aesab:matrix.org/context/$Cocha3ohqu2oos1nui3uong7huuyaele?limit=0&filter=%7B%22lazy_load_members%22%3Atrue%7D)
	at org.matrix.rustcomponents.sdk.FfiConverterTypeClientError.read(SourceFile:26)
	at org.matrix.rustcomponents.sdk.FfiConverterRustBuffer$DefaultImpls.liftFromRustBuffer(SourceFile:13)
	at org.matrix.rustcomponents.sdk.FfiConverterTypeClientError.liftFromRustBuffer(SourceFile:1)
	at org.matrix.rustcomponents.sdk.FfiConverterRustBuffer$DefaultImpls.lift(SourceFile:6)
	at org.matrix.rustcomponents.sdk.ClientException$ErrorHandler.lift(SourceFile:8)
	at org.matrix.rustcomponents.sdk.Matrix_sdk_ffiKt.access$uniffiCheckCallStatus(SourceFile:123)
	at org.matrix.rustcomponents.sdk.Matrix_sdk_ffiKt.uniffiRustCallAsync(SourceFile:194)
	at org.matrix.rustcomponents.sdk.Matrix_sdk_ffiKt$uniffiRustCallAsync$1.invokeSuspend(Unknown Source:17)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:9)
	at kotlinx.coroutines.DispatchedTask.run(SourceFile:107)
	at androidx.core.app.ActivityRecreator$1.run(SourceFile:47)
	at kotlinx.coroutines.scheduling.TaskImpl.run(SourceFile:3)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:93)
 | 
2024-10-22T17:38:17.894194Z  WARN elementx: [Push/PushHandler] Unable to get a notification data | 

10-22 19:38:27.886  1516  2121 D ActivityManager: freezing 25342 io.element.android.x

Android Developers: Power management restrictions states that an app's network is restricted to a window at a specific interval during doze. On the other hand, Firebase Cloud Messaging has no restrictions for high priority notifications during doze. I am not sure if this is what @MatMaul meant by "when an app is wake up by FCM, it is given special treatment by the OS and can access the network and do stuff in the background for a certain period of time". I may be misunderstanding @MatMaul and/or the Android Developers docs.

Regardless, if I enable unrestricted background usage for Element X, everything works:

image

This feels wrong, but if FCM has special permissions in Android (even AOSP!?), I guess there isn't much we can do as long as the message content is fetched and decrypted separately from the notification (as it should).

@seankhl
Copy link

seankhl commented Oct 22, 2024

Sadly this doesn't solve the problem for me. As mentioned above I already tried this: both apps are set to unrestricted and I still don't get notifications.

One thing to note is that even though I've set this and opened Element X multiple times, it still doesn't appear in the "Active apps" list in the bottom circular tile in the Android drop-down menu, which is suspicious to me.

@caspervk
Copy link

Element X also does not appear in the "Active apps" list for me - but ntfy does. I would encourage you to check if ntfy correctly receives and dispatches the notification through adb logcat to make sure the issue truly is with Element X. That helped me a lot in the debugging process.

@ThomChroma
Copy link

@seankhl after changing the default ntfy server, did you delete the active subscription for Element X then launch Element X again so that it creates a new subscription to the new ntfy server?

@devurandom
Copy link

See-also: #3571

@p1gp1g
Copy link

p1gp1g commented Nov 1, 2024

The error raised by EAX when it tries to go to the foreground when it can't (so we need to unrestrict it) will be fixed when EAX will be using the next version of UnifiedPush library, and users will use a distributor following the recent spec updates

The library has a release candidate for the new version: 3.0.0-rc2, and the changes can be reviewed here: https://codeberg.org/UnifiedPush/android-connector/pulls/2

Technical details

@p1gp1g
Copy link

p1gp1g commented Nov 1, 2024

It would be a good solution to also:

  • Check permissions before starting a foreground service and falling back to a background service (a try/catch should work too)
  • Or see if a workmanager does the job

This is also useful for FCM since they downgrade the high priority messages to normal priority if the app is not surfacing time sensitive content to the user (see https://developer.android.com/develop/background-work/services/foreground-services#bg-access-restrictions)

@K4LCIFER
Copy link
Author

K4LCIFER commented Nov 3, 2024

My notifications appear to all of a sudden be working now with 0.7.2 (maybe even 0.7.1, but I'm not completely sure on that). I haven't changed any config with Ntfy, or Element X. They're just working.

@Atemu
Copy link

Atemu commented Nov 4, 2024

Same for me, a few hours ago I suddenly got a bunch of messages. This was approximately 17:00 UTC on Sunday (2024-11-03T17:00:00).

At that time, I was on 0.7.1, so this happened without any modification to the software stack on my end.

@devurandom
Copy link

This does not seem universal. When I run Settings > Notifications > Troubleshoot, I still get "https://fcm.distributor.unifiedpush.org/_matrix/push/v1/notify is not a Matrix gateway".

@K4LCIFER
Copy link
Author

K4LCIFER commented Nov 4, 2024

At that time, I was on 0.7.1, so this happened without any modification to the software stack on my end.

I hesitantly want to say the same. I got all the notifications while it seemed that I was on 0.7.1, but I was in the process of updating to 0.7.2 when I got them, so I'm not 100% sure if the same is the case for me or if something had been changed in the update process.

@K4LCIFER
Copy link
Author

K4LCIFER commented Nov 4, 2024

This does not seem universal. When I run Settings > Notifications > Troubleshoot, I still get "https://fcm.distributor.unifiedpush.org/_matrix/push/v1/notify is not a Matrix gateway".

This error sounds unique to what this issue is reporting. I could be wrong, but that seems like something different.

@Atemu
Copy link

Atemu commented Nov 4, 2024

I'd like to clarify that I use the default ntfy back-end. So just install the ntfy app and set it as the push provider, no further config.

@p1gp1g
Copy link

p1gp1g commented Nov 4, 2024

This does not seem universal. When I run Settings > Notifications > Troubleshoot, I still get "https://fcm.distributor.unifiedpush.org/_matrix/push/v1/notify is not a Matrix gateway".

You have this issue: #3571

@p1gp1g
Copy link

p1gp1g commented Nov 4, 2024

I'd like to clarify that I use the default ntfy back-end. So just install the ntfy app and set it as the push provider, no further config.

  1. Unrestrict battery optimization for ntfy and element-x (see Not receiving notifications on the F-Droid version with unified push #3031 (comment))
  2. Unregister element from ntfy *
  3. Restart element-x

* I suspect a bug where rejected keys are not renewed, they are removed by synapse but I'm not sure EAX re-register the key: https://github.com/element-hq/synapse/blob/c705beebf7e95f25624ec38280192d96bc207626/synapse/push/httppusher.py#L368

@K4LCIFER
Copy link
Author

K4LCIFER commented Nov 9, 2024

Should this issue be closed since notifications are now being received via unified push? However, I feel that some official explanation for why it's working all of a sudden should be first stated before this issue is closed.

@audishos
Copy link

I was not receiving notifications even though the unified push topic was being added to ntfy and the troubleshooter was passing. I was previously running Fluffy chat, kept it installed in case I decided to switch back, but disabled its notifications within the app. This had the unfortunate side-effect of disabling all unified push channels, including the one added by Element X. Re-enabling notification within Fluffy chat resolved it. If you need to disable notifications for Fluffy chat, you can do it from the native android app notification settings without disabling unified push entirely.

This is an edge case, but posting here just in case it helps anyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Push O-Occasional Affects or can be seen by some users regularly or most users rarely S-Critical Prevents work, causes data loss and/or has no workaround T-Defect Something isn't working: bugs, crashes, hangs and other reported problems Z-UnifiedPush
Projects
None yet
Development

No branches or pull requests