Xamarin: Sample Push Notification Application using GCM service

Summary

Through this blog I hope to be able to provide you enough information to build a push chat notification application. To write a push chat application we need a service which will receive the notification to publish to all registered users and second, an application which can publish any important news to the Google Push Notification server.

Service

In this example we are using 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.

Application

This is an android based application which 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 :

  1. Step1: Create a GCM service projectXPA_1
  2. Step 2: Provide API access permission of GCM to android.XPA_2
  3. 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.

    XPA_3

To create a Push Chat Notification Application :

  1. Step1: Create a Xamarin Android application.
  2. Step2: Add GCM service, Json.net and http client from NuGet online service.XPA_4
  3. Step3: Add permission to your Push chat application. Below is the copy of the manifest xml.XPA_5
  4. Step4: Deploy your application on your android mobile and send any notification!

Author: Bivash Biswas