Hacker News new | past | comments | ask | show | jobs | submit login

Unfortunately, Google has made it (almost) impossible to wake up the phone via some external event without using its proprietary GCM. Even though GCM is not part of AOSP, it has unique status on the platform that can't easily be replicated (without recompiling the kernel, etc like the article mentions).

Before the days of doze mode & other battery optimizations, you could just listen & block on a socket, then let the phone go to sleep. Incoming 3G packets would wake up the phone, you grab a wakelock, then start doing things. From what I remember, at least a while ago Facebook Messenger did this using MQTT. But this is not possible any more.




It works quite well for me with the Conversations Jabber client with no discernible battery usage impact.

Did something change in recent Android versions?

Edit: Apparently Nougat's Doze is the issue. Conversations bug report, you can apparently put it on a whitelist:

https://github.com/siacs/Conversations/issues/1624


Kind of tangential, but GCM is deprecated and you're supposed to use Firebase Cloud Messaging now: https://firebase.google.com/docs/cloud-messaging/

It's still just a JAR (no native components), so AFAICT there's no technical reason someone else couldn't do a similar thing with their own servers.


> It's just a JAR (no native components)

I’ve reversed it, and rebuilt an alternative

The jar you include actually opens just an IPC channel to the Google Play Services framework, which runs with system permissions, and handles the actual stuff.

You can’t implement your own FCM without having root access on EVERY Android phone out there.


Maybe not. Although there's this guy: https://eladnava.com/pushy-a-new-alternative-to-google-cloud..., it seems like his library doesn't work very well after Nougat.


From Android 6 on, Doze just terminates apps running in background after a while. The only network access that is allowed is GCM.

Which causes the entire issue.

I wrote a complaint to the EU privacy official responsible for them and the EU antitrust committee.


That's an excellent idea! Do you have a blog or something where you're going to post when (if) you get a response?


> Before the days of doze mode & other battery optimizations, you could just listen & block on a socket, then let the phone go to sleep. Incoming 3G packets would wake up the phone, you grab a wakelock, then start doing things. From what I remember, at least a while ago Facebook Messenger did this using MQTT. But this is not possible any more.

It's not a coincidence that the Facebook app was known for being an absolute battery killer. Go to any android forum post about battery life from a year or more ago and you'll see that the first suggestion is always "have you tried removing Facebook?"


That's still the case now, just for different reasons.


That's why Facebook Lite is great way to get rid of battery draining Facebook app.


That's very easy to manage. Every random 15-60 minutes a gcm/firebase message containing an encrypted payload with "you got this mail/no mail for you sir". So google cant get your frequency of use.


It's my impression that most people use Signal as an SMS app replacement, and in that environment people would not find a random 15-60 minute delay until their phone tells them about an incoming message to be tenable. I certainly wouldn't.


>Unfortunately, Google has made it (almost) impossible to wake up the phone via some external event without using its proprietary GCM

No, fortunately Google has made it impossible for apps to abuse waking up the phone.


No. Apps can abuse waking up the phone all they want (and as much as user lets them), as long as they do it via Google's servers. What they can't do is bypass GCM/FCM. Nothing to do with UX.


Any apps that try to abuse it will quickly be flagged by Google for analysis.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: