Coder Social home page Coder Social logo

daxpayne / fcm.net Goto Github PK

View Code? Open in Web Editor NEW

This project forked from angelobelchior/fcm.net

0.0 1.0 0.0 2.59 MB

Biblioteca para facilitar envio de Push Notification usando o Firebase Cloud Messaging do Google

License: MIT License

C# 98.32% Batchfile 1.68%

fcm.net's Introduction

FCM.Net

FCM.Net is designed to make it easy to send Push Notification using Google's Firebase Cloud Messaging

This library was written following Google's own documentation to make it easier to send messages from a server app / desktop app (Console Application, Asp.Net, Windows Forms, WPF, etc).


O FCM.Net foi criado para facilitar envio de Push Notification usando o Firebase Cloud Messaging do Google

Essa biblioteca foi escrita seguindo a documentação do próprio Google com o intuito de facilitar o envio de mensagens a partir de um server app ou um desktop app (Console Application, Asp.Net, Windows Forms, WPF, etc).

Sample / Exemplo

var registrationId = "ID generated when device is registered in FCM / ID gerado quando o device é registrado no FCM";
var serverKey = "https://console.firebase.google.com/project/MY_PROJECT/settings/cloudmessaging";

using(var sender = new Sender(serverKey))
{
    var message = new Message
    {
        RegistrationIds = new List<string> { registrationId },
        Notification = new Notification
        {
            Title = "Test from FCM.Net",
            Body = $"Hello World@!{DateTime.Now.ToString()}"
        }
    };
    var result = await sender.SendAsync(message);
    Console.WriteLine($"Success: {result.MessageResponse.Success}");
        
    var json = "{\"notification\":{\"title\":\"json message\",\"body\":\"works like a charm!\"},\"to\":\"" + registrationId + "\"}";
    result = await sender.SendAsync(json);
    Console.WriteLine($"Success: {result.MessageResponse.Success}");
}

Reference table for more details on how to set up your notification / Tabela de referência para maiores detalhes de como montar sua notificação

Installation / Instalação

Package Manager

> Install-Package FCM.Net

.NET CLI

> dotnet add package FCM.Net

Tests / Testes

There are three test projects within the Solution. Two of these projects are console-type applications.

.Net 4.6 Project, .Net Core Project and the third test application is an Android App made in Xamarin. To test it you need to have Xamarin installed and configured.

If you want to know more about Xamarin I created a playlist for beginners: http://bit.ly/XamarinParaIniciantes. [Pt-Br]

If you do not have Xamarin installed and want to test, you can disable it by right-clicking on the FCM.Net.PCL.Playground project and selecting Unload Project.


Existem três projetos de teste dentro da Solution. Dois desses projetos são aplicações do tipo console.

Uma é para o .Net 4.6 e a outra para .Net Core. A terceira aplicação de testes é um App para Android feito em Xamarin. para testa-lo é necessário ter o Xamarin instalado e configurado.

Caso queira conhecer mais sobre Xamarin criei uma playlist para iniciantes: http://bit.ly/XamarinParaIniciantes.

Caso você não tenha o Xamarin instalado e queira testar, pode desativa-lo clicando com o botão direito no projeto FCM.Net.PCL.Playground e selecionando Unload Project.

fcm.net's People

Contributors

angelobelchior avatar herberthenrique avatar adilson avatar adilson-tkrw avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.