PushSharp 介绍
PushSharp 实现了服务器端向移动客户端推送消息的库,支持 iOS (iPhone/iPad APNS), Android (C2DM and GCM
- Google Cloud Message), Windows Phone, 和 Windows 8 devices!
示例代码:
//Create our push services broker var push = new Pushbroker(); //Registering the Apple Service and sending an iOS Notification var appleCert = File.ReadAllBytes("ApnsSandBoxCert.p12")); push.RegisterappleService(new ApplePushChannelSettings(appleCert, "pwd")); push.QueueNotification(new AppleNotification() .ForDevicetoken("DEVICE TOKEN HERE") .WithAlert("Hello World!") .WithBadge(7) .WithSound("sound.caf")); //Registering the GCM Service and sending an Android Notification push.RegisterGcmService(new GcmpushChannelSettings("theauthorizationtokenhere")); //Fluent construction of an Android GCM Notification //IMPORTANT: For Android you MUST use your own RegistrationId here that gets generated within your Android app itself! push.QueueNotification(new GcmNotification().ForDeviceRegistrationId("DEVICE REGISTRATION ID HERE") .WithJson("{\"alert\":\"Hello World!\",\"badge\":7,\"sound\":\"sound.caf\"}"));
PushSharp 官网
https://github.com/Redth/PushSharp
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。