|
|
@ -3,7 +3,9 @@ using System.Threading.Tasks; |
|
|
|
using FirebaseAdmin; |
|
|
|
using Google.Apis.Auth.OAuth2; |
|
|
|
using System; |
|
|
|
|
|
|
|
using BCS.BMC.FirebaseCloudMessaging.Dto; |
|
|
|
using System.Collections.Generic; |
|
|
|
using Abp.Json; |
|
|
|
|
|
|
|
namespace BCS.BMC.FirebaseCloudMessaging |
|
|
|
{ |
|
|
@ -22,18 +24,19 @@ namespace BCS.BMC.FirebaseCloudMessaging |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static async Task<string> SendNotification(string fcmToken, Notification notification) |
|
|
|
public static async Task<BatchResponse> SendNotification( FireBaseResponseModel notification) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
var message = new Message() |
|
|
|
{ |
|
|
|
Notification = notification, |
|
|
|
Token = fcmToken, |
|
|
|
}; |
|
|
|
|
|
|
|
var message = new MulticastMessage() |
|
|
|
{ |
|
|
|
Notification = notification.notification, |
|
|
|
Tokens = notification.FcmToken, |
|
|
|
}; |
|
|
|
|
|
|
|
return await FirebaseMessaging.DefaultInstance.SendAsync(message) ; |
|
|
|
|
|
|
|
var response = await FirebaseMessaging.DefaultInstance.SendMulticastAsync(message); |
|
|
|
return response; |
|
|
|
} |
|
|
|
catch(Exception ex) |
|
|
|
{ |
|
|
|