Send Push to Android by C# Using Fcm (Firebase Cloud Messaging)

Send push to Android by C# using Firebase and get response

you could save a response to database
and in the app could get a response from database.
The information will be in Database.

Sending Push Notification on Android Device using Firebase (FCM)

"invalid registration" indicates that the device token is incorrect, does not point to an existing device.

Mind that this does not mean a device that's turned off, it means that no device (currently) uses that token at all.

In other words it's an indication of a bad recipient address, effectively the equivalent of an HTTP 404 error.

C# FCM for Android Push Notification

I found the error. As a back-end developer I worked on C# part only. There is one more step to be done from mobile application side. Mobile app should allow receiving messages from list of Sender Ids so the one that I use in my C# code must be allowed from mobile app side. Once I did that it worked

Send In App Message to Android by C# .NET using Firebase In App Messaging

There currently is no API to configure the messages delivered/displayed by Firebase In-app Messaging. If this is a use-case you'd like to see added, I recommend you file a feature request.

The closest work-around at the moment would be to use Firebase Remote Config (which does have an API for setting configuration data) to deliver some value to your clients, and then have your clients display the message on those conditions. This is somewhat similar to what Firebase's In-app Messaging does behind the scenes, although (as far as I know) it uses its own infrastructure to deliver the configuration data.

FCM (Firebase Cloud Messaging) Push Notification with Asp.Net

C# Server Side Code For Firebase Cloud Messaging

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Script.Serialization;

namespace Sch_WCFApplication
{
public class PushNotification
{
public PushNotification(Plobj obj)
{
try
{
var applicationID = "AIza---------4GcVJj4dI";

var senderId = "57-------55";

string deviceId = "euxqdp------ioIdL87abVL";

WebRequest tRequest = WebRequest.Create("https://fcm.googleapis.com/fcm/send");

tRequest.Method = "post";

tRequest.ContentType = "application/json";

var data = new

{

to = deviceId,

notification = new

{

body = obj.Message,

title = obj.TagMsg,

icon = "myicon"

}
};

var serializer = new JavaScriptSerializer();

var json = serializer.Serialize(data);

Byte[] byteArray = Encoding.UTF8.GetBytes(json);

tRequest.Headers.Add(string.Format("Authorization: key={0}", applicationID));

tRequest.Headers.Add(string.Format("Sender: id={0}", senderId));

tRequest.ContentLength = byteArray.Length;

using (Stream dataStream = tRequest.GetRequestStream())
{

dataStream.Write(byteArray, 0, byteArray.Length);

using (WebResponse tResponse = tRequest.GetResponse())
{

using (Stream dataStreamResponse = tResponse.GetResponseStream())
{

using (StreamReader tReader = new StreamReader(dataStreamResponse))
{

String sResponseFromServer = tReader.ReadToEnd();

string str = sResponseFromServer;

}
}
}
}
}

catch (Exception ex)
{

string str = ex.Message;

}

}

}
}

APIKey and senderId , You get is here---------as follow(Below Images)
(go to your firebase App)

Step. 1

Step. 2

Step. 3



Related Topics



Leave a reply



Submit