A while back, people here kindly explained how typical commercial Android apps get push notifications. Quick version: notifiications are sent through Firebase Cloud Messaging (FCM), which communicates with Google Message Services (GMS), an always-on Android client app preinstalled on most Android phones. There's a FOSS alternative to GMS called MicroG but it's still an FCM client, and FCM is an evil Google service that client apps that use it have to enroll with even if you escape GMS on the client side.
Right now I'm interested in sending myself push notifications from a self-hosted service that I run on a VPS. Of course I don't want to deal with FCM. I also prefer to not have to develop an Android app as opposed to running something like an XMPP client.
It looks like there are some alternatives like Iris and Unified Push (unifiedpush.org). It looks to me that UP becoming the preferred solution, is that right? UP has its own always-on client that can receive messages from a UP server that you can self-host. This sounds ok to me in principle.
My main question is whether UP is somehow worse than GMS, in terms of being a background app that keeps a network connection open. Is GMS anything special in that regard, besides being preinstalled by Google? Would GMS use less battery power or anything like that?
I may also have to look into how XMPP works, if my server program is going to send messages through it. I actually have an unrelated reason to be interested in XMPP. But does that approach sound reasonable? Are there XMPP clients that are non-bloaty, don't eat battery energy in the background, etc.? I'd like a loud audio alert if I get one of these notifications from my server. Can I usually easily set up XMPP clients to allow that only from my own service, while not making sounds for anything else? I'm luddite enough that I still use IRC for online chat, but maybe I have to catch up with the ~~20th~~ 21st century about this. Is there a good community to discuss XMPP development and self-hosting? I.e. I'd want to self-host the XMPP server and use it to send messages to my phone from my own (also self-hosted) server app.
The simplest alternative I can think of is for my server program to just sometimes send me SMS messages through Twilio or similar. The alerts will be infrequent enough that I don't mind going this route. Does that sound easier? It's less in the self-hosted spirit but it gets rid of a lot of software on both the server and the phone, I guess.
Thanks!
Thanks, yes, that is very helpful and is the type of thing I was wondering about, and also whether GCM somehow got wakeups from the baseband instead of just waiting on TCP.
I actually don't know whether I'm running anything right now that uses GCM in any important way. That presumes incoming phone calls and SMS really are alerted by the baseband and not by GCM (not sure if that is true). I'm using K9 from F-droid so presumably with no GCM credentials, and it seems to me (now that I think of it) that it polls IMAP every few minutes or so, somehow without obviously running in the background, hmm.
Anyway for this immediate application I guess I won't worry about battery impact too much unless I really notice a problem. I think listening on a socket is important enough that I should check into how well it works. The SMS approach seems like the lowest overhead in power usage though.