Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
325 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am using ASP.NET Core Web API to send push notifications to Android and iOS devices using the method given below. I am not using any API endpoint directly. Should I change anything in this?
string jsonPayLoad = string.Empty;
//if (hubNotification.DeviceType.ToLower().Equals("ios.") || hubNotification.DeviceType.ToLower().Contains("iphone") || hubNotification.DeviceType.ToLower().Contains("ipad"))// For sending to iOS
//{
NotificationOutcome outcome;
if (hubNotification.DeviceType.ToLower().Contains("android"))
{
// var registeredNewDevice = hub.CreateGcmNativeRegistrationAsync(hubNotification.DeviceId.Replace("-", ""), new[] { hubNotification.ToUserEmail }).Result;
var registeredNewDevice = hub.CreateGcmNativeRegistrationAsync(hubNotification.DeviceId, new[] { hubNotification.ToUserEmail }).Result;
//Silent Notification
jsonPayLoad = "{ \"data\": " +
"{" +
"\"content-available\":" + 1 + "," +
"\"sound\":\"\"," +
"\"notificationType\": \"" + hubNotification.NotificationType + "\"," +
"\"type\":\"sendfriend\"}}";
outcome = hub.SendGcmNativeNotificationAsync(jsonPayLoad, hubNotification.ToUserEmail).Result;
@Vijay Pratap Singh Apologies for late response! I discussed your scenario internally with PG and you would need to use FCM v1. The code shows that you are still using GCM. The JSON payload needs to be updated to FCM v1.
Please let us know if further query.