6 ms·
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 par
by clumsysmurf 10y ago
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.
- chimeracoder 10y ago> 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?"
- Mathnerd314 10y agoKind of tangential, but GCM is deprecated and you're supposed to use Firebase Cloud Messaging now: https://firebase.google.com/docs/cloud-messaging/ 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.
- kuschku 10y ago> 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.
- Mathnerd314 10y agoMaybe not. Although there's this guy: https://eladnava.com/pushy-a-new-alternative-to-google-cloud-messaging/ https://eladnava.com/pushy-a-new-alternative-to-google-cloud..., it seems like his library doesn't work very well after Nougat.
- kuschku 10y agoFrom 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.
- codethief 10y agoThat's an excellent idea! Do you have a blog or something where you're going to post when (if) you get a response?
- lima 10y agoIt 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 https://github.com/siacs/Conversations/issues/1624
- ucy 10y agoThat'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.
- caf 10y agoIt'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.
- bitmapbrother 10y ago>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.
- Drdrdrq 10y agoNo. 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.
- bitmapbrother 10y agoAny apps that try to abuse it will quickly be flagged by Google for analysis.