我是 Push Sharp 的新手。我正在尝试使用 Push Sharp 向 Android 设备发送消息。它工作得很好,但问题是 Push Sharp 一次又一次地发送相同的消息。
我的代码是:
AndroidPushBroker = new PushBroker();
var googleKey = CustomConfigurationManager.GetValueFromSection("appSettings", "GoogleServerAccessKey");
AndroidPushBroker.RegisterGcmService(new PushSharp.Android.GcmPushChannelSettings(googleKey));
var jsonMessage = "{\"InformationId\":\"" + notification.Message + "\",\"badge\":7,\"sound\":\"sound.caf\",\"NotificationType\":\"" + notification.Type.ToString() + "\"}";
GcmNotification androidNotifcation = new GcmNotification().ForDeviceRegistrationId(notification.DeviceId)
.WithJson(jsonMessage);
AndroidPushBroker.QueueNotification(androidNotifcation);
问题:当我发送消息“消息 1”然后发送“消息 2”时,它再次发送“消息 1”。我需要从 Queue 中删除项目吗?或者我错过了什么。?
注意:我的应用程序中有单个 Push Broker 实例。