November 22, 2018 10:05 by
Peter
In developing mobile web backends you might need users to broadcast messages such as push notifications to single or all mobile subscribers from the cloud using services like Firebase Cloud Messaging (FCM).
In this article we will focus on sending push notifications from a .Net application using Firebase.Notification library. This library makes it very easy to send push notifications from Firebase using C#
To begin, download the library from Nuget:
Install-Package Firebase.Notification -Version 1.0.0
Using the library:
using (var firebase = new Firebase())
{
firebase.ServerKey = "{Your Server Key}";
var id = "{Your Device Id}";
firebase.PushNotifyAsync(id,"Hello","World").Wait();
Console.ReadLine();
}
Error Handling and Debugging
Trace errors in your output window, all errors from this library will be captured under the category Firebase.Notification for easy debugging,
HostForLIFE.eu ASP.NET Core 2.2.1 Hosting
European best, cheap and reliable ASP.NET hosting with instant activation. HostForLIFE.eu is #1 Recommended Windows and ASP.NET hosting in European Continent. With 99.99% Uptime Guaranteed of Relibility, Stability and Performace. HostForLIFE.eu security team is constantly monitoring the entire network for unusual behaviour. We deliver hosting solution including Shared hosting, Cloud hosting, Reseller hosting, Dedicated Servers, and IT as Service for companies of all size.