Xamarin: Sample Push Notification Application using GCM service
Through this blog, I hope to be able to provide you with enough information to build a push chat notification application. To write a push chat application we need a service that will receive the notification to publish to all registered users and second, an application that can publish any important news to the Google Push Notification server.
In this example, we are using the GCM service to receive the notification and publish it to all registered users. We can create a GCM service using console.developers.google.com API. After we create a GCM service, the push chat notification application is ready for use. The application is written using Xamarin.
This is an Android-based application that can be used to publish important news to all deployed and registered mobile users through the Google Push Notification server. Whenever a new post occurs a notification will be sent to every registered user.
To create a GCM service :
- Step1: Create a GCM service project
- Step 2: Provide API access permission of GCM to Android.
- Step 3: In order to send and receive notifications, two important things to note are:– The project number for registering your application to GCM; and
– The project API key to send the message to GCM for notifying all registered applications/mobiles.
To create a Push Chat Notification Application :
- Step 1: Create an Xamarin Android application.
- Step 2: Add GCM service, Json.net, and HTTP client from NuGet online service.
- Step 3: Add permission to your Push chat application. Below is a copy of the manifest XML.
- Step 4: Deploy your application on your Android mobile and send any notification!
Author: Bivash Biswas