Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Firebase;
- using System;
- namespace TestPushNotification
- {
- class Program
- {
- private static readonly PushNotification Notification = PushNotification.GetPushNotification();
- static void Main(string[] args)
- {
- Notification.Config.YOUR_FCM_SERVER_API_KEY = "AIzaSyAlGYEvGdTGOR1qSbJ1t35-DJbB7u0FMJ0";
- Notification.Config.YOUR_FCM_SENDER_ID = "";
- SendNotification();
- SendCustomNotification();
- Console.ReadLine();
- }
- public static void SendNotification()
- {
- string fcmDeviceId = "fqVLhCOtiz8:APA91bGEyCjgWkTFCdJVeIldTTAyUF2eu36zf0_rE9cCFlMn7-MiMviGKTcvGfIb0TKmWJKbDdJGbz4Qw3sQv5EG5GduDyM7uoddsTpYXjdYfAOt0Sv7NVLBoBIyB4_nPR0PkrR5LJYB";
- string title = "Test Miky";
- string message = "My Message";
- string sResponseFromServer = Notification.SendNotification(fcmDeviceId, title, message);
- Console.WriteLine(sResponseFromServer);
- }
- public static void SendCustomNotification()
- {
- string fcmDeviceId = "fqVLhCOtiz8:APA91bGEyCjgWkTFCdJVeIldTTAyUF2eu36zf0_rE9cCFlMn7-MiMviGKTcvGfIb0TKmWJKbDdJGbz4Qw3sQv5EG5GduDyM7uoddsTpYXjdYfAOt0Sv7NVLBoBIyB4_nPR0PkrR5LJYB";
- string _title = "Test Miky";
- string _message = "My Message";
- var data = new
- {
- to = fcmDeviceId, // Uncoment this if you want to test for single device
- priority = "high",
- content_available = true,
- notification = new
- {
- title = _title,
- body = _message,
- //icon="myicon"
- badge = 1,
- sound = "default"
- }
- };
- string sResponseFromServer = Notification.SendNotification(fcmDeviceId, data);
- Console.WriteLine(sResponseFromServer);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement