├── C2dmSharp.Client ├── Properties │ ├── AssemblyInfo.cs │ └── AndroidManifest.xml ├── C2dmExceptions.cs ├── C2dmBroadcastReceiver.cs ├── C2dmSharp.Client.csproj ├── C2dmClient.cs └── C2dmService.cs ├── C2dmSharp.Client.Sample ├── Resources │ ├── drawable-hdpi │ │ └── icon.png │ ├── drawable-ldpi │ │ └── icon.png │ ├── drawable-mdpi │ │ └── icon.png │ ├── layout │ │ └── main.axml │ ├── Resource.Designer.cs │ └── AboutResources.txt ├── Assets │ └── AboutAssets.txt ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs ├── DefaultActivity.cs ├── C2dmSharp.Client.Sample.csproj └── SampleService.cs ├── C2dmSharp.Server.Sample ├── app.config ├── Properties │ └── AssemblyInfo.cs ├── C2dmSharp.Server.Sample.csproj └── Program.cs ├── C2dmSharp.Server ├── App.config ├── C2dmMessageTransportWorker.cs ├── C2dmMessageTransportResponse.cs ├── C2dmExceptions.cs ├── Properties │ └── AssemblyInfo.cs ├── C2dmMessage.cs ├── C2dmSharp.Server.csproj ├── C2dmMessageTransport.cs ├── C2dmMessageTransportAsync.cs └── C2dmService.cs ├── README.markdown └── C2dmSharp.sln /C2dmSharp.Client/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Redth/C2DM-Sharp/HEAD/C2dmSharp.Client/Properties/AssemblyInfo.cs -------------------------------------------------------------------------------- /C2dmSharp.Client.Sample/Resources/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Redth/C2DM-Sharp/HEAD/C2dmSharp.Client.Sample/Resources/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /C2dmSharp.Client.Sample/Resources/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Redth/C2DM-Sharp/HEAD/C2dmSharp.Client.Sample/Resources/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /C2dmSharp.Client.Sample/Resources/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Redth/C2DM-Sharp/HEAD/C2dmSharp.Client.Sample/Resources/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /C2dmSharp.Server.Sample/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /C2dmSharp.Server/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /C2dmSharp.Client.Sample/Assets/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories) and given a Build Action of "AndroidAsset". 3 | 4 | These files will be deployed with you package and will be accessible using Android's 5 | AssetManager, like this: 6 | 7 | public class ReadAsset : Activity 8 | { 9 | protected override void OnCreate (Bundle bundle) 10 | { 11 | base.OnCreate (bundle); 12 | 13 | InputStream input = Assets.Open ("my_asset.txt"); 14 | } 15 | } 16 | 17 | Additionally, some Android functions will automatically load asset files: 18 | 19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); -------------------------------------------------------------------------------- /C2dmSharp.Client.Sample/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /C2dmSharp.Server/C2dmMessageTransportWorker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace C2dmSharp.Server 9 | { 10 | internal class C2dmMessageTransportWorker 11 | { 12 | CancellationTokenSource cancelTokenSource; 13 | 14 | public C2dmMessageTransportWorker() 15 | { 16 | this.Id = Guid.NewGuid().ToString(); 17 | this.cancelTokenSource = new CancellationTokenSource(); 18 | } 19 | 20 | public string Id 21 | { 22 | get; 23 | private set; 24 | } 25 | 26 | public void Stop() 27 | { 28 | try 29 | { 30 | this.cancelTokenSource.Cancel(); 31 | this.Task.Wait(cancelTokenSource.Token); 32 | } 33 | catch { } 34 | } 35 | 36 | public CancellationToken CancelToken 37 | { 38 | get { return cancelTokenSource.Token; } 39 | } 40 | 41 | public Task Task 42 | { 43 | get; 44 | set; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /C2dmSharp.Server/C2dmMessageTransportResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace C2dmSharp.Server 7 | { 8 | public class C2dmMessageTransportResponse 9 | { 10 | public string MessageId 11 | { 12 | get; 13 | set; 14 | } 15 | 16 | public C2dmMessage Message 17 | { 18 | get; 19 | set; 20 | } 21 | 22 | public MessageTransportResponseCode ResponseCode 23 | { 24 | get; 25 | set; 26 | } 27 | 28 | public MessageTransportResponseStatus ResponseStatus 29 | { 30 | get; 31 | set; 32 | } 33 | } 34 | 35 | public enum MessageTransportResponseCode 36 | { 37 | Ok, 38 | Error, 39 | ServiceUnavailable, 40 | InvalidAuthToken 41 | } 42 | 43 | public enum MessageTransportResponseStatus 44 | { 45 | Ok, 46 | Error, 47 | QuotaExceeded, 48 | DeviceQuotaExceeded, 49 | InvalidRegistration, 50 | NotRegistered, 51 | MessageTooBig, 52 | MissingCollapseKey, 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /C2dmSharp.Client.Sample/Resources/layout/main.axml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 17 | 21 |