How to test FCM/GCM integration without server side ?
Usually when mobile developers start working with server side APIs/calls not all the APIs have implemented, they mock the response and work on it till the back-side will be ready .
When we talk about FCM , sometimes we face integration problems, which is sometimes related to code implementation itself, or to server side configurations, or server side implementation for push notification . At least android developers would like to ensure that everything from their side work properly and there is no problems in code implementation and device registration .
How we can do that ?
Simply via any rest client like:
1-Advanced REST client.
2-Yet Another REST Client.
3-Rest Web Service Client.
4-HTTP Client Pro.
6- Restlet Client.
let’s do it with Restlet Client , you can add Restlet Client to google chrome from here
How to configure push notification ?
Let’s follow these quick steps :
1- URL : http://android.googleapis.com/gcm/send .
2- Method: POST .
- Content-Type : application/json
- Authorization : key=AIzaS………
So what is key = $$$ ?
It is api_key in you google-services.json file , you have to replace $$$ with your current_key value .
4- Body : you need to get device registration ID to your Application id at GCM .
If you have a working code , you can generate it , if not , please check this Helper APP to generate it .
5- You need to mock your Json Payload to add it as value in data attribute .
Finally the post-body has to be something like that :
once you press send, you have to see the response like this .
Once you have message_id , you will receive a push notification for the registered device id .