我正在使用Azure通知集线器向GCM和APN发送推送通知时,我注意到生产中它只发送给前10个注册设备,而其他新注册设备无法接收消息它已经在GCM上注册。我需要的是发送到所有注册的设备,他们是圆形600设备。公共类通知 { public static Notifications Instance = new Notifications();MS Azure仅向10个设备发送通知
public NotificationHubClient Hub { get; set; }
private Notifications()
{
string NotificationHubConnectionString = WebConfigurationManager.AppSettings["NotificationHubConnectionString"];
string NotificationHubPath = WebConfigurationManager.AppSettings["NotificationHubPath"];
Hub = NotificationHubClient.CreateClientFromConnectionString(NotificationHubConnectionString, NotificationHubPath, false);
}
public static async void SendNotificationAsync(string Message, string Type, string ID, string Date, string Summery, string Location, string Risk)
{
string to_tag = Type.Replace(" ", string.Empty);
try
{
var notif = "{ \"data\" : {\"message\":\"" + Message + "\",\"type\":\"" + Type + "\",\"ID\":\"" + ID + "\",\"Date\":\"" + Date + "\",\"Summery\":\"" + Summery + "\",\"Risk\":\"" + Risk + "\",\"Location\":\"" + Location + "\"" + ", \"sound\" : \"default\"}}";
var outcome = await Notifications.Instance.Hub.SendGcmNativeNotificationAsync(notif);
string msg = string.Format("This Notification: " + Message + " has been delivered to this number [" + outcome.Success.ToString() + "] of android Mobiles");
Logger.LogMessage(msg, EventLogEntryType.Information);
}
catch (Exception ex)
{
string msg = string.Format("Coudn't send notification to android mobiles");
Logger.LogMessage(msg, EventLogEntryType.Error);
Logger.LogException(ex, EventLogEntryType.Error);
}
try
{
var alert = "{\"aps\":{\"alert\":\"" + Message + "\",\"type\":\"" + Type + "\",\"ID\":\"" + ID + "\",\"Date\":\"" + Date + "\",\"Summery\":\"" + Summery + "\",\"Risk\":\"" + Risk + "\",\"location\":\"" + Location + "\" " + ", \"sound\" : \"default\"}}";
var outcome = await Notifications.Instance.Hub.SendAppleNativeNotificationAsync(alert, to_tag);
string msg = string.Format("This Notification: " + Message + " has been delivered to this number ["+ outcome.Success.ToString() +"] of IOS Mobiles");
Logger.LogMessage(msg, EventLogEntryType.Information);
}
catch (Exception ex)
{
string msg = string.Format("Coudn't send notification to IOS mobiles");
Logger.LogMessage(msg, EventLogEntryType.Error);
Logger.LogException(ex, EventLogEntryType.Error);
}
}
你是什么意思? –