PushMate.FcmPushService 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package PushMate.FcmPushService --version 1.0.0
NuGet\Install-Package PushMate.FcmPushService -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PushMate.FcmPushService" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PushMate.FcmPushService --version 1.0.0
#r "nuget: PushMate.FcmPushService, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PushMate.FcmPushService as a Cake Addin
#addin nuget:?package=PushMate.FcmPushService&version=1.0.0

// Install PushMate.FcmPushService as a Cake Tool
#tool nuget:?package=PushMate.FcmPushService&version=1.0.0

Push Mate

Push Notifications Systems written in .NET Core 2.1.

This component has the responsibility of parsing an Message object or a json, validate the notification attributes and send it to the Firebase Cloud Messaging

Based on project FCM.NET (https://github.com/angelobelchior/FCM.Net)

How to use it

You need to have your own FCM Server Key to use this library. (Learn more here https://firebase.google.com/docs/cloud-messaging/server)

Create a Message instance:

var message = new Message
           {
               RegistrationIds = new List<string> { registrationId },
               Notification = new Notification
               {
                   Title = "Title",
                   Body = $"Hello World@!{DateTime.Now.ToString()}"
               }
           };

Or simply use a JSON with the correct schema (https://firebase.google.com/docs/cloud-messaging/concept-options):

string validJson = "{ \"registration_ids\":[\"dG4rFnirWOE:APA91bE3COnsY-flnulPse4b4uKZOUDRpdOAe6DGTU_jWGtJt0P_hBXoN1tOa9Je4ZyAfA11OS3US0fZm6M7EljYipCY1f4MqjDLLvEltfe8_3aDnzwTxRbuw23HQ2JIY2ihXQXUvDym\"],\"priority\":\"Normal\",\"notification\":{\"title\":\"Title\",\"body\":\"Hello World@!23-Jun-18 19:58:47\"}}";

Example of JSON request object:

{
 "message":{
   "token":"bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
   "notification":{
     "title":"Portugal vs. Denmark",
     "body":"great match!"
   },
   "data" : {
     "Nick" : "Mario",
     "Room" : "PortugalVSDenmark"
   }
 }
}

Create an instance of the service FcmPushService:

var fcmPushService = new FcmPushService(serverKey, null, new MockedHttpClientOK());

Call the async method for sending a push notification (for now it only supports HTTPS; XMPP on the road map);

var result = await fcmPushService.SendAsync(validJson);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 1,325 6/26/2018
1.0.0 882 6/24/2018

This first version supports only HTTPS communication with FCM.