PushSharp 2.x
=============
A server-side library for sending Push Notifications to iOS (iPhone/iPad APNS), Android (C2DM and GCM - Google Cloud Message), Windows Phone, and Windows 8 devices!
![PushSharp Diagram](https://github.com/Redth/PushSharp/raw/master/Resources/PushSharp-Diagram.png)
*********
###Join me at Xamarin Evolve for a session on Push Notifications and PushSharp!###
I will be presenting a session during the conference days at Xamarin Evolve in Austin, TX, April 14-17.
Visit [http://xamarin.com/evolve/](http://xamarin.com/evolve "Xamarin.com/Evolve") for more info!
News
----
**March 19, 2013** 2.0 is released! See the release notes below...
*******
**PushSharp Jabbr Channel!** http://jabbr.net/#/rooms/PushSharp
******
Features
--------
- Supports sending push notifications for many platforms:
- Apple (APNS - iPhone, iPad, Mountain Lion)
- Android (GCM/C2DM - Phones/Tablets)
- Windows Phone 7 / 7.5 / 8 (including FlipTile, CycleTile, and IconicTile Templates!)
- Windows 8
- Firefox OS (Coming soon)
- Fluent API for constructing Notifications for each platform
- Auto Scaling of notification channels (more workers/connections are added as demand increases, and scaled down as it decreases)
- 100% managed code awesomeness for Mono compatibility!
- Unit Tests
*******
Documentation
-------------
Head over to the [Wiki](https://github.com/Redth/PushSharp/wiki) for some documentation, guides, etc.
- [How to Configure & Send Apple Push Notifications using PushSharp](https://github.com/Redth/PushSharp/wiki/How-to-Configure-&-Send-Apple-Push-Notifications-using-PushSharp)
- [How to Configure & Send Android GCM Google Cloud Messaging Push Notifications using PushSharp](https://github.com/Redth/PushSharp/wiki/How-to-Configure-&-Send-GCM-Google-Cloud-Messaging-Push-Notifications-using-PushSharp)
*******
PushSharp Featured in Xamarin Seminar!
--------------------------------------
On August 9th, 2012, I had the great honor of hosting a Xamarin Seminar on Push Notifications, and introducing PushSharp. If you missed it, the video and slides are all online now!
- [Push Notifications - Introduction to PushSharp - Video](http://www.youtube.com/watch?v=MytQ6vqrE5g)
- [Push Notifications - Introduction to PushSharp - Slides](http://www.slideshare.net/Xamarin/push-notifications-introduction-to-pushsharp-seminar)
*******
Sample Code
-------------------
Using the library to send push notifications should be easy, and the platform fairly abstracted away... Here's some sample code:
```csharp
//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\"}"));
```
Please see the PushSharp.Sample project for a more thorough example!
********************
v2.0 Release Notes
------------------
PushSharp v2.0 has finally arrived. It is the culmination of hours of refactoring, decoupling, simplifying, and testing. The main emphasis on this release was to refactor the code to decouple various classes so that Unit Tests could finally be written.
**Changes**
- PushService was renamed to PushBroker
- PushSharp.Common is now PushSharp.Core
- PushSharp assembly was merged with PushSharp.Core
- PushSharp.Core no longer depends on each specific platform, but each specific platform depends on PushSharp.Core
- Unit Tests are now available using NUnit and Moq
- Push 'Channels' are now less sophisticated and not responsible for handling their own queues, which should result in fewer possible points of failure
- Each specific platform assembly is now dependant on PushSharp.Core
- Scaling logic was greatly improved
- Apple (APNS) more stable and resilient to connection failures
- Various other bugfixes
**PushBroker - Registering Services**
Since PushSharp.Core no longer references individual platform assemblies, it was not practical to keep the same pattern of pushSharpInstance.StartApplePushService(...). Instead, PushBroker contains a .RegisterService<TNotification>(TPushService svc) method.
In addition, each platform also includes extension methods to assist in registering the platform specific services. If you are using the PushSharp namespace, for example, you could call pushBrokerInstance.RegisterAppleService(...) which works very similarly to how the old PushService methods worked!
See the sample for more info!
**Thanks!**
Special thanks goes out to the MvvmCross room on Jabbr, and especially Greg Shackles for his helpful suggestions and feedback during the refactoring process!
********************
FAQ's
------------------------
##### How do I use PushSharp in my ASP.NET Web Application? #####
The ideal way is to create a ***singleton PushBroker instance*** in your Global.asax file. You should keep this singleton instance around for the lifespan of your web application. You should not be creating and destroying instances of PushBroker each time you send a notification, as this uses unnecessary resources and if you're using Apple APNS, they require you to keep the connection to their servers open as long as possible when sending notifications.
##### How do I support multiple iOS/GCM/WP/W8 Apps with PushSharp? #####
For every unique application you are sending notifications to, you should create an instance of PushBroker. Each PushBroker instance can only support a single application for each platform.
********************
MonoTouch and Mono for Android Client Application Integration
---------------------------------------------------------------------
Given that PushSharp is written in C#, you probably thought there was a good chance that it's being used somewhere with MonoTouch or Mono for Android... and you would be correct! There are samples of how to setup the client app push notification end of things included in the PushSharp project source! There's even a Windows Phone 7.5 project to show how to register for notifications!
All client samples can be found in the **/Client.Samples/** folder.
PushSharp.ClientSample.MonoForAndroid
-----------------------------------------
There are two projects for Mono For Android:
1. PushSharp.ClientSample.C2dm
2. PushSharp.ClientSample.Gcm
C2DM is now deprecated by Google, and you can ignore it unless you are working with an application that already uses it. Otherwise, focus on the *GCM* project.
The GCM project also references the ***/PushSharp.Client/PushSharp.Client.MonoForAndroid.Gcm*** project which is a client library (ported from the java gcm-client library). It is a helper library for managing GCM registrations on the client side, within your Android app. You don't necessarily need to understand the code in this library, but just know that this Client Sample project references it for its own use!
**VERY IMPORTANT NOTE:** Make sure your package name does not start with an uppercase character. If it does, you will get cryptic errors in logcat and things will not work, because your package name is used in defining some permissions required by GCM.
Eg: my.package.name
没有合适的资源?快使用搜索试试~ 我知道了~
发送推送通知的服务器端库
共250个文件
cs:101个
png:37个
nupkg:25个
5星 · 超过95%的资源 需积分: 9 10 下载量 95 浏览量
2013-05-08
20:39:24
上传
评论
收藏 10.48MB 7Z 举报
温馨提示
一个向iOS(iPhone/iPad APNS)、Android(C2DM和GCM)、Windows Phone和Windows 8设备发送推送通知的服务器端库。
资源推荐
资源详情
资源评论
收起资源包目录
发送推送通知的服务器端库 (250个子文件)
Main.axml 1KB
Main.axml 1KB
packages.config 272B
config 263B
NuGet.Config 164B
app.config 141B
packages.config 140B
packages.config 140B
packages.config 140B
WindowsFluent.cs 76KB
WindowsPhonePushFluent.cs 20KB
WindowsPhoneNotification.cs 18KB
WindowsNotification.cs 15KB
ApplePushChannel.cs 15KB
GcmPushChannel.cs 13KB
PushServiceBase.cs 13KB
C2dmPushChannel.cs 10KB
GcmTests.cs 10KB
WindowsPushChannel.cs 9KB
PushClient.cs 8KB
AppleNotificationPayload.cs 8KB
Program.cs 7KB
ApnsTestServer.cs 7KB
PushHandlerServiceBase.cs 6KB
ApplePushChannelSettings.cs 6KB
AppleNotification.cs 6KB
WindowsPhonePushChannel.cs 6KB
GcmTestServer.cs 5KB
PushService.cs 5KB
App.xaml.cs 5KB
AppleTests.cs 4KB
GCMConstants.cs 4KB
PushService.cs 4KB
AppleFluentNotification.cs 4KB
PushServiceTests.cs 4KB
PushSharpClient.cs 4KB
FeedbackService.cs 3KB
PushBroker.cs 3KB
GcmNotification.cs 3KB
AppDelegate.cs 3KB
BlackberryPushChannel.cs 3KB
DefaultActivity.cs 3KB
DefaultActivity.cs 3KB
ApplePushService.cs 3KB
PushClient.cs 3KB
PushHandlerServiceBase.cs 3KB
Resource.designer.cs 3KB
Resource.designer.cs 3KB
C2dmNotification.cs 2KB
AppDelegate.cs 2KB
Interfaces.cs 2KB
WindowsPhonePushBrokerExtensions.cs 2KB
AppleNotificationAlert.cs 2KB
Exceptions.cs 2KB
GcmMessageTransportResponse.cs 2KB
WindowsPhonePushService.cs 2KB
GcmFluentNotification.cs 2KB
WindowsPushBrokerExtensions.cs 2KB
C2dmExceptions.cs 1KB
AssemblyInfo.cs 1KB
C2dmFluentNotification.cs 1KB
C2dmPushService.cs 1KB
WindowsPushService.cs 1KB
AssemblyInfo.cs 1KB
GcmPushService.cs 1KB
TileNotificationTemplate.cs 1KB
GcmExceptions.cs 1KB
C2dmExceptions.cs 1KB
AssemblyInfo.cs 1KB
AssemblyInfo.cs 1KB
AssemblyInfo.cs 1009B
GcmPushChannelSettings.cs 1008B
AssemblyInfo.cs 1005B
AssemblyInfo.cs 999B
AssemblyInfo.cs 999B
AssemblyInfo.cs 997B
AssemblyInfo.cs 997B
AssemblyInfo.cs 993B
WindowsPhonePushChannelSettings.cs 991B
Log.cs 937B
Notification.cs 909B
MainWindowController.cs 906B
SendNotificationResult.cs 885B
WindowsPhoneMessageStatus.cs 856B
PushHandlerBroadcastReceiverBase.cs 855B
WindowsNotificationStatus.cs 785B
CoreTests.cs 767B
PushHandlerBroadcastReceiverBase.cs 748B
WindowsNotificationFactory.cs 729B
C2dmMessageTransportResponse.cs 726B
PushServiceSettings.cs 719B
BlackberryPushService.cs 701B
WindowsPushChannelSettings.cs 670B
C2dmPushChannelSettings.cs 631B
MainWindow.cs 618B
GcmPushBrokerExtensions.cs 609B
MainPage.xaml.cs 602B
ApplePushBrokerExtensions.cs 595B
C2dmPushBrokerExtensions.cs 589B
AssemblyVersionInfo.cs 516B
共 250 条
- 1
- 2
- 3
资源评论
- zhang7402014-03-03很好用的库,不错
- chen633131092013-05-31这个看上去很强大啊,不过visual studio版本要比较新的。
by2n
- 粉丝: 106
- 资源: 36
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功