1,新建項目,在項目中添加引用,dll文件已經上傳在百度網盤,點擊下載
2,引入命名空間
PushSharp.WindowsPhone;
3,初始化寫入下面代碼
push = push.OnNotificationSent +=+=+=+=+=+=+=+= appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, push.RegisterAppleService( ApplePushChannelSettings(appleCert, )); push.QueueNotification( push.RegisterGcmService( GcmPushChannelSettings( push.QueueNotification( GcmNotification().ForDeviceRegistrationId( Uri(
4,實現注冊方法
DeviceSubscriptionChanged( sender, oldSubscriptionId, Console.WriteLine( + oldSubscriptionId + + newSubscriptionId + + NotificationSent( + sender + + NotificationFailed( + sender + + notificationFailureException.Message + + ChannelException( + sender + + ServiceException( + sender + + DeviceSubscriptionExpired( sender, + sender + + ChannelDestroyed( + ChannelCreated( +
5,大功告成,每一種系統都需要不同的驗證信息,有完整的信息在使用本例子(比如ios證書,密碼,設備tokenID等),親自測過,正常!
6,有什麼不懂的地方和我聯系([email protected])