PushSharp 实现了服务器端向移动客户端推送消息的库,支持 iOS (iPhone/iPad APNS), Android (C2DM and GCM - Google Cloud Message), Windows Phone, 和 Windows 8 devices!

示例代码:
02 |
var push = new PushBroker(); |
05 |
var appleCert = File.ReadAllBytes("ApnsSandboxCert.p12")); |
06 |
push.RegisterAppleService(new ApplePushChannelSettings(appleCert, "pwd")); |
07 |
push.QueueNotification(new AppleNotification() |
08 |
.ForDeviceToken("DEVICE TOKEN HERE") |
09 |
.WithAlert("Hello World!") |
11 |
.WithSound("sound.caf")); |
15 |
push.RegisterGcmService(new GcmPushChannelSettings("theauthorizationtokenhere")); |
18 |
push.QueueNotification(new GcmNotification().ForDeviceRegistrationId("DEVICE REGISTRATION ID HERE") |
19 |
.WithJson("{\"alert\":\"Hello World!\",\"badge\":7,\"sound\":\"sound. |