IOSプラットフォームに紺碧を使用してブロードキャスト通知を送信する形式を次のようにJSONペイロードを送信します。は、IOSとAndroid
{"aps":{"alert":"Notification Hub test notification"}}
Androidのペイロード形式であるのに対し:
{"data":{"message":"Notification Hub test notification"}}
マイSendBroadcastNotification
:
public void SendBroadcastNotification(string message) {
NotificationHubClient hub = NotificationHubClient
.CreateClientFromConnectionString(Constants.NotificationsHubConnectionString, "QiKStayNotificationHub",true);
var notify = "{ \"data\" : {\"message\":\"" + message + "\"}}";
var appnotify = "{ \"aps\" : {\"alert\":\"" + message + "\"}}";
var task = hub.SendGcmNativeNotificationAsync(notify);
task.Wait();
}
ここから私は特にSendGcmNativeNotificationAsyncにアンドロイドに通知を送りますすべてのデバイスにブロードキャストします。あなたは維持する必要があり、通知ハブユーザーのプラットフォームとデバイスを登録同様に
hubClient.SendAppleNativeNotificationAsync();
hubClient.SendGcmNativeNotificationAsync(notify);
SendGcmNativeNotificationAsyncはすべてのアンドロイドデバイスとSendAppleNativeNotificationAにブロードキャストします同期はすべてのリンゴデバイスにブロードキャストされます – Mahesh