diff --git a/MessageSender/MessageSender.xproj b/MessageSender/MessageSender.xproj
new file mode 100644
index 00000000..222981f4
--- /dev/null
+++ b/MessageSender/MessageSender.xproj
@@ -0,0 +1,22 @@
+
+
+
+ 14.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ 2f4ae1ac-5311-483b-ab03-f8bfdf998f29
+ MessageSender
+ .\obj
+ .\bin\
+ v4.5.2
+
+
+ 2.0
+
+
+ True
+
+
+
\ No newline at end of file
diff --git a/MessageSender/MessageSender.xproj.user b/MessageSender/MessageSender.xproj.user
new file mode 100644
index 00000000..bc5e9832
--- /dev/null
+++ b/MessageSender/MessageSender.xproj.user
@@ -0,0 +1,6 @@
+
+
+
+ console1
+
+
\ No newline at end of file
diff --git a/MessageSender/Program.cs b/MessageSender/Program.cs
new file mode 100644
index 00000000..7bd387f0
--- /dev/null
+++ b/MessageSender/Program.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text;
+using System.Threading.Tasks;
+using Newtonsoft.Json.Linq;
+
+namespace MessageSender
+{
+ public class Program
+ {
+ public const string API_KEY = "AIzaSyDwPlu2ky9AoPwDvThoXxJwqiPq-Tc8p8k";
+ public const string MESSAGE = "Hello, Xamarin!";
+
+ static void Main(string[] args)
+ {
+ var jGcmData = new JObject();
+ var jData = new JObject();
+
+ jData.Add("message", MESSAGE);
+ jGcmData.Add("to", "/topics/global");
+ jGcmData.Add("data", jData);
+
+ var url = new Uri("https://gcm-http.googleapis.com/gcm/send");
+ try
+ {
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Accept.Add(
+ new MediaTypeWithQualityHeaderValue("application/json"));
+
+ client.DefaultRequestHeaders.TryAddWithoutValidation(
+ "Authorization", "key=" + API_KEY);
+
+ Task.WaitAll(client.PostAsync(url,
+ new StringContent(jGcmData.ToString(), Encoding.Default, "application/json"))
+ .ContinueWith(response =>
+ {
+ Console.WriteLine(response);
+ Console.WriteLine("Message sent: check the client device notification tray.");
+ }));
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Unable to send GCM message:");
+ Console.Error.WriteLine(e.StackTrace);
+ }
+ }
+ }
+}
diff --git a/MessageSender/Properties/AssemblyInfo.cs b/MessageSender/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..b99a04e3
--- /dev/null
+++ b/MessageSender/Properties/AssemblyInfo.cs
@@ -0,0 +1,19 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MessageSender")]
+[assembly: AssemblyTrademark("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("2f4ae1ac-5311-483b-ab03-f8bfdf998f29")]
diff --git a/MessageSender/Properties/launchSettings.json b/MessageSender/Properties/launchSettings.json
new file mode 100644
index 00000000..3a2cb634
--- /dev/null
+++ b/MessageSender/Properties/launchSettings.json
@@ -0,0 +1,5 @@
+{
+ "profiles": {
+ "console1": {}
+ }
+}
\ No newline at end of file
diff --git a/MessageSender/project.json b/MessageSender/project.json
new file mode 100644
index 00000000..2d200be1
--- /dev/null
+++ b/MessageSender/project.json
@@ -0,0 +1,21 @@
+{
+ "version": "1.0.0-*",
+ "buildOptions": {
+ "emitEntryPoint": true
+ },
+
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "type": "build",
+ "version": "1.0.0-rc2-3002702"
+ },
+ "Newtonsoft.Json": "9.0.1"
+ },
+
+ "frameworks": {
+ "dnx451": {"compilationOptions": {"emitEntryPoint": true}},
+ "netcoreapp1.0": {
+ "imports": "dnxcore50"
+ }
+ }
+}
diff --git a/MessageSender/project.lock.json b/MessageSender/project.lock.json
new file mode 100644
index 00000000..3535509f
--- /dev/null
+++ b/MessageSender/project.lock.json
@@ -0,0 +1,92 @@
+{
+ "locked": false,
+ "version": 2,
+ "targets": {
+ "DNX,Version=v4.5.1": {
+ "Microsoft.NETCore.App/1.0.0-rc2-3002702": {
+ "type": "package"
+ },
+ "Newtonsoft.Json/9.0.1": {
+ "type": "package",
+ "compile": {
+ "lib/net45/Newtonsoft.Json.dll": {}
+ },
+ "runtime": {
+ "lib/net45/Newtonsoft.Json.dll": {}
+ }
+ }
+ },
+ "DNX,Version=v4.5.1/win7-x86": {
+ "Microsoft.NETCore.App/1.0.0-rc2-3002702": {
+ "type": "package"
+ },
+ "Newtonsoft.Json/9.0.1": {
+ "type": "package",
+ "compile": {
+ "lib/net45/Newtonsoft.Json.dll": {}
+ },
+ "runtime": {
+ "lib/net45/Newtonsoft.Json.dll": {}
+ }
+ }
+ },
+ "DNX,Version=v4.5.1/win7-x64": {
+ "Microsoft.NETCore.App/1.0.0-rc2-3002702": {
+ "type": "package"
+ },
+ "Newtonsoft.Json/9.0.1": {
+ "type": "package",
+ "compile": {
+ "lib/net45/Newtonsoft.Json.dll": {}
+ },
+ "runtime": {
+ "lib/net45/Newtonsoft.Json.dll": {}
+ }
+ }
+ }
+ },
+ "libraries": {
+ "Microsoft.NETCore.App/1.0.0-rc2-3002702": {
+ "type": "package",
+ "sha512": "G+wsg7zwathgjAOZ2w0XbHU0MD4GEHIpi/JsvBGmbACW+/Dsx2YoXai7LLItfe5ZVidqBXXQCz8NxCKbKqr8Ww==",
+ "files": [
+ "dotnet_library_license.txt",
+ "Microsoft.NETCore.App.1.0.0-rc2-3002702.nupkg",
+ "Microsoft.NETCore.App.1.0.0-rc2-3002702.nupkg.sha512",
+ "Microsoft.NETCore.App.nuspec",
+ "ThirdPartyNotices.txt"
+ ]
+ },
+ "Newtonsoft.Json/9.0.1": {
+ "type": "package",
+ "sha512": "U82mHQSKaIk+lpSVCbWYKNavmNH1i5xrExDEquU1i6I5pV6UMOqRnJRSlKO3cMPfcpp0RgDY+8jUXHdQ4IfXvw==",
+ "files": [
+ "lib/net20/Newtonsoft.Json.dll",
+ "lib/net20/Newtonsoft.Json.xml",
+ "lib/net35/Newtonsoft.Json.dll",
+ "lib/net35/Newtonsoft.Json.xml",
+ "lib/net40/Newtonsoft.Json.dll",
+ "lib/net40/Newtonsoft.Json.xml",
+ "lib/net45/Newtonsoft.Json.dll",
+ "lib/net45/Newtonsoft.Json.xml",
+ "lib/netstandard1.0/Newtonsoft.Json.dll",
+ "lib/netstandard1.0/Newtonsoft.Json.xml",
+ "lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll",
+ "lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.xml",
+ "lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll",
+ "lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.xml",
+ "Newtonsoft.Json.9.0.1.nupkg",
+ "Newtonsoft.Json.9.0.1.nupkg.sha512",
+ "Newtonsoft.Json.nuspec",
+ "tools/install.ps1"
+ ]
+ }
+ },
+ "projectFileDependencyGroups": {
+ "": [
+ "Microsoft.NETCore.App >= 1.0.0-rc2-3002702",
+ "Newtonsoft.Json >= 9.0.1"
+ ],
+ "DNX,Version=v4.5.1": []
+ }
+}
\ No newline at end of file