Android - How do certain apps show new notifications when internet access is restricted to them?

App developers can tell better but what I perceive is that many modern apps use Firebase Cloud Messaging - a proprietary service from Google, not part of AOSP - for push notifications. In fact developers are forced to use Google's proprietary products unnoticeably. Quoted from here:

The Doze restriction on network access is also likely to affect your app, especially if the app relies on real-time messages such as tickles or notifications. If your app requires a persistent connection to the network to receive messages, you should use Firebase Cloud Messaging (FCM) if possible.
...
FCM is optimized to work with Doze and App Standby idle modes by means of high-priority FCM messages.

FCM is a part of Google Play Services (1):

FCM SDK's only hard dependency is Google Play Services

Play Services is a set of apps which are injected to Android devices with highly privileged permissions, so they aren't subject to data/battery restrictions.

Since you have blocked only the app and not Play Services, app may receive push notifications (though the actual data may not be delivered to the app).

So block GMS in order to block push notifications. Or choose the apps which aren't fond of Google.

RELATED: What is the exact functionality of Google Play Services & Services Framework?


WhatsApp can't access the internet at then moment. However it still receives the configured push notifications via Google Play Services. The Google Play Service is a different app on your device that still has Internet access.

Those push messages don't contain the actual message and WhatsApp just uses them as a notifier. Whenever such a push notification message arrives WhatsApp knows that there are new messages and tries to contact the WhatsApp server to retrieve it.

In your case the connection to the WhatsApp server fails and WhatsApp only displays you the message "You might have new messages".


No, WhatsApp does not hack around the network restrictions.

The app, after a certain amount not being able to connect to its server because you have disabled internet connection, is just guessing. That's why you get the message: "You may have new messages" from its Failure notifications channel.

From How to stop WhatsApp 'You may have new messages' notification:

As such, though WhatsApp is running and mobile data is turned on, it may not be able to access the internet. It's only recourse is therefore to throw this notification as a guess since I suspect it can’t tell the difference when a poor network is to blame and when its network rights are being micromanaged by the OS.