3 ms·
GCM/FCM will delay low priority notifications, in order to batch as many together as possible. On top of that, the cell networks don't allow keeping a socket o
by tjohns 7y ago
GCM/FCM will delay low priority notifications, in order to batch as many together as possible.
On top of that, the cell networks don't allow keeping a socket open for more than a few minutes without sending keepalive packets. Unlike on desktop, keeping a socket open isn't "free" on mobile.
Waking up the cell radio has a significant penalty on battery life.
(And yes, Android batches up process wakeups as well. See the docs on "Doze Mode": https://developer.android.com/training/monitoring-device-state/doze-standby https://developer.android.com/training/monitoring-device-sta...)
- AshamedCaptain 7y agoSo you just batch the keepalives, like the old Nokias were doing. Reaching 1 month long battery lifes with Jabber on. Absolutely no difference 1 having to send 1 keepalive every 5 minutes than 30. This is just a subversion of basic networking in order to centralize everything through a single provider and as usual the users are trained to see it as necessary without questioning it.
- vinay_ys 7y ago> On top of that, the cell networks don't allow keeping a socket open for more than a few minutes without sending keepalive packets. Unlike on desktop, keeping a socket open isn't "free" on mobile. You are wrong. Cell networks don't prevent you from keeping a socket open for however long you want. For how to keep your sockets alive, see https://developer.android.com/reference/android/net/SocketKeepalive?hl=en https://developer.android.com/reference/android/net/SocketKe...
- anticensor 7y agoKeepalive across cells are not universally available. Most mobile networks renew your IP at each handover.
- tjohns 7y agoThat method just instructs the OS to send keepalive packets on a system thread. It saves some CPU power by letting your process sleep, but still requires waking the cell radio up periodically. The implementation can be found here: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/net/ConnectivityManager.java https://github.com/aosp-mirror/platform_frameworks_base/blob...
- vinay_ys 7y agoThat's right. And it should work as advertised in the documentation. Anyway, I was responding to the "cell networks don't allow" part of your comment. Cell networks don't have a say in what I do at IP/TCP layer.
- B-Con 7y agoThey literally said that cell networks don't allow it without the keep alive. You quoted it and said they were wrong because... you can use a keep alive. I'm confused as to what you're correcting.
- namibj 7y agoThere are collaborations between mobile network providers and push notification providers to get these sockets special-cased. I.e., they won't need keep-alive at any regular interval. So the radio can actually get layer-1 pings (like, when you're called, or get an SMS) for push notifications.