I have set up Charles proxy to intercept network traffic coming into an Android app running on the Android Emulator.
In Charles, Help > SSL Proxying > Install Root Certificate on a Mobile Device or Remote Browser
In Android emulator, ...
The regular network traffic of the app comes through Charles proxy but not the push notifications.
Is there a way to intercept the push notifications with Charles?
I've seen that the documentation says that they come through on ports 5228-5230 on HTTP. https://developers.google.com/cloud-messaging/http
I can imagine for security this might be made more difficult. I've seen this previous answer Intercept all GCM push messages(for any app) but it doesn't give any detail of why it can't be done.
FCM is a cloud platform that provides messages and push notifications for operating systems- ios and Android, and websites as well. Google Cloud Messaging is a messaging service that enables the message transfer from server to clients apps.
Google Cloud Messaging (GCM) was a mobile notification service developed by Google that enables third-party application developers to send notification data or information from developer-run servers to applications that target the Google Android Operating System, as well as applications or extensions developed for the ...
With FCM, you can send two types of messages to clients: Notification messages, sometimes thought of as "display messages." These are handled by the FCM SDK automatically. Data messages, which are handled by the client app.
I think GCM notifications does not come directly to your app as http traffic. I think they work with Google Play Services installed on your phone which then triggers your app with "something".
After searching for it I've found this which I will quote here for reference:
There is simply a TCP socket waiting in accept mode on a cloud Google server. The TCP connection had been initiated by the Google Play application. That's why Google Play must be installed on the device for making Google Cloud Messaging (GCM) (formerly Android Cloud to Device Messaging Service - C2DM) work.
When this TCP client socket receives some message, the message contains information such as the package name of the application it should be addressed to, and of course - the data itself. This data is parsed and packed into an intent that is broadcast and eventually received by the application.
The TCP socket stays open even when the device's radio state turns into "idle" mode. Applications don't have to be running to receive the intents.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With