Push notification 如何使用Redth PushSharp库向多个平台发送推送通知?
我一直在使用代码为Android和iPhone实现服务器端推送 使用以下代码:Push notification 如何使用Redth PushSharp库向多个平台发送推送通知?,push-notification,apple-push-notifications,google-cloud-messaging,pushsharp,Push Notification,Apple Push Notifications,Google Cloud Messaging,Pushsharp,我一直在使用代码为Android和iPhone实现服务器端推送 使用以下代码: foreach (Receipient in iOSUsers) { push.QueueNotification(NotificationFactory.Apple() .ForDeviceToken(APNS_Device_Token_Of_Receipient) .WithAlert("Ale
foreach (Receipient in iOSUsers)
{
push.QueueNotification(NotificationFactory.Apple()
.ForDeviceToken(APNS_Device_Token_Of_Receipient)
.WithAlert("Alert!")
.WithSound("default")
.WithBadge(2));
}
foreach (Receipient in GCMUsers)
{
push.QueueNotification(NotificationFactory.AndroidGcm()
.ForDeviceRegistrationId(GCM_Device_Token_Of_Receipient)
.WithCollapseKey("NONE")
.WithJson("Alert!"));
}
我的问题是,我一次只能发送到一个平台,上面的代码只发送到iPhone,如果第一个循环被禁用,那么只有Android用户才会收到推送消息
有线索吗
如果需要,我可以添加其他代码
谢谢 看一看
.WithExpiry()
指定您发送的邮件的过期日期。我创建了一个windows服务,该服务获取ios用户和android用户的列表,并为每个调用提供一个pushbroker对象实例和如上所述的进程。您将有多个线程处理所有ios和android