element-hq / element-android

A Matrix collaboration client for Android.
https://element.io/
GNU Affero General Public License v3.0
3.38k stars 726 forks source link

Notifications aren't sent when on mobile data with android's "Data Saver" on #2801

Open michaelharmonart opened 3 years ago

michaelharmonart commented 3 years ago

As said in the title, notifications don't send when on mobile data, with data saver on. When element is opened, it updates and receives the notifications. This isn't a problem for other messaging services, including google voice and hangouts (both of which have perfectly functioning notifications with data saver)

Each time I run the notification troubleshooter it responds that everything looks good. When I turn data saver off, notifications function properly again.

I would expect notifications to work with data saver on, considering that it isn't a problem for other messaging services.

I'm using a moto e5 play My homeserver is matrix.org, and I have installed the app from the google play store.

This isn't a problem for me any more since I now have unlimited data, but I still It should still be addressed (although how high a priority it should be I don't know).

ghost commented 3 years ago

Me too

justdave commented 3 years ago

I suspect the messaging services that work are using Google's messaging service (which is allowed to talk to the OS when in data saver because they control it) where Element is probably maintaining a connection to your home server to watch for events (and that connection gets cut when you turn on Data Saver). I don't know the code so I don't know that's what's happening, but from investigating push notifications for my own app, I'm going to take a wild guess that Element can't implement that because the app would need to register a single notification service with Google, and stuff would have to be implemented server side on every home server to talk to the same Google account to submit notifications to it (and since they aren't all operated by the same people, nobody's going to want to share the credentials around for that Google account to talk to the notification service). That's one of the down sides of having decentralized services.

justdave commented 3 years ago

Nah, I was wrong, I should have actually looked at it first. It is using Firebase after all, and the client is generating a token and handing it off to the home server to use to submit the notifications. So you can ignore most of what you said and the reason it works like that remains a mystery....