Start a Project

How to send push notifications using Google API

In this blog, we will see how we can send push notifications using Google API. For this, we have to first create valid payload data, which we will pass in the request body and we also need the Firebase server key of our Firebase project.

Let start, you need to add the below code in a ViewController and call the below function when you want to trigger the notification.

In the above method, we have created payloadData dictionary and passed it to the request body. We have created a variable token. The token variable stores the firebase device token. we will set the device tokens of that device on which we want to send a push notification. We also need a firebase server key which we can get from our firebase project inside the firebase console.

When the Google API is hit successfully then we can see the push notifications on the device.

Thanks for reading this blog.

Please follow the above steps in order to send push notifications through Google API to the selected device. You can also check other blogs from here. If you have any issues, query or suggestions then you can leave your issues/query/suggestion in the comment section.

Exit mobile version