Press "Enter" to skip to content

Firebase push notifications made simple in Xamarin

Working with push notifications can be challenging because each platform has its own way of implementing it. Firebase Cloud Messaging allows you to send/receive notifications to a specific device or topics based. It has components for Xamarin iOS and Xamarin Android but setting them up and getting it to work properly might be frustrating especially when you are new into this subject. That's why just released a plugin to make this simpler to setup and handle. It's basically an abstraction of the common parts but also providing enough flexibility to customize. In this article will show the plugin features and a step by step video of setting it up in your project.

Plugin Features

  • Receive firebase push notifications
  • Subscribing/Unsubscribing to topics
  • Support for push notification category actions
  • Customize push notification


The following events will allow you to have push notification related feedback across iOS and Android:

OnTokenRefresh - Provides feedback when token is updated.

CrossFirebasePushNotification.Current.OnTokenRefresh += (s,p) =>
    System.Diagnostics.Debug.WriteLine($"TOKEN : {p.Token}");

OnNotificationReceived - Provides feedback when notification is received.

CrossFirebasePushNotification.Current.OnNotificationReceived += (s,p) =>

OnNotificationOpened- Provides feedback when notification is opened.

 CrossFirebasePushNotification.Current.OnNotificationOpened += (s,p) =>
                foreach(var data in p.Data)
                    System.Diagnostics.Debug.WriteLine($"{data.Key} : {data.Value}");

                    System.Diagnostics.Debug.WriteLine($"ActionId: {p.Identifier}");


Cross platform topic subscription

Topic subscription allows you to group devices within a particular topic. In a way that only devices in subscribing to a specific topic will get push notifications for that topic. You can subscribe to topics on iOS and Android in the same way.

//Subscribing to single topic

//Subscribing to multiple topics
CrossFirebasePushNotification.Current.Subscribe(new string[]{"baseball","football"});

//Unsubscribing to single topic

//Unsubscribing from multiple topics
CrossFirebasePushNotification.Current.Unsubscribe(new string[]{"food","music"});

//Unsubscribing from all topics

Notification Category Actions

It's very handy nowadays to have push notifications with buttons, that allows our applications to get an instant response from the user by just tapping on a notification button. For example, if your application sends friend requests to users might be useful to have two options "Accept" and "Reject".

Push Notification Handler

On Android, you are able to override the default behavior when a notification arrives by implementing IPushNotificationHandler and initializing the plugin with your own implementation that will allow you to provide any customization based on your needs. More details on this on the full documentation referenced on the end of this article.

To get started you must get everything ready on firebase portal. You can follow this steps: Firebase Setup

Here a brief step by step video on setting it up in your project:

Check out the full documentation here: Firebase Push Notification Plugin

Happy Pushing Notifications!


  1. Sid Sid


    that's really usefull but I'm facing some issue with the last release 2.0.1-alpha
    I configured everthing as explained in your tutorial but I didn't receive anything on iPhone (iPhone 5 / 6 / 7).

    Apps is asking me for authorization but I never receive anythings and I tryed with all the payloads published in your github tutorial.

    What can I do to fix it?


    • Rendy Rendy

      Did you get to solve your issue?

  2. Adigma Adigma

    Unfortunately unsubsribing from Topics is not working at all.
    Messages still come through.
    Anybody else noticed this issue ?

  3. Rendy Rendy

    Do you get any errors on the console?

    Is this on iOS or Android?

    Where are you unsubscribing?

Leave a Reply

Your email address will not be published. Required fields are marked *