我正在用android C2DM发送通知。我正在使用C2dmSharp。 我正在尝试向手机发送200种不同的通知。服务器端我得到一个OK响应,id = [已发送消息的ID](如记录的here),所以我猜我的服务运行良好。但在我的手机上我只收到一些通知......不是200!好的,我知道它不是有保障的服务,但它就像90%的未发送通知。我做错了吗?实际上是否可以连续向一台设备发送200条消息?
如果你知道一个更好的地方问这个,请赐教:)
我正在使用this发送通知
以下是代码:
if (notificationService != null)
{
notificationService.Start();
foreach (var itemToProcess in itemsToProcess)
{
itemToProcess.NotificationDateTime = DateTime.Now;
mobile.SubmitChanges();
string deviceToken = GetCleanDeviceToken(itemToProcess.MobileDevice.PushNotificationIdentifier);
var extras = new NameValueCollection();
extras.Add("salemessage", itemToProcess.MobileDeviceNotificationText.Text);
extras.Add("ismultisale", "false");
if (itemToProcess.SaleId.HasValue) extras.Add("saleid", itemToProcess.SaleId.Value.ToString());
try
{
Thread.Sleep(200);
notificationService.QueueMessage(deviceToken, extras, "key");
}
catch (Exception exception)
{
//logging
}
}
notificationService.Stop();
}