sendmsg ok sous GNU/Linux
This commit is contained in:
parent
cb4a77423f
commit
bafd6e00e4
7 changed files with 0 additions and 216 deletions
|
|
@ -1,22 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
|
||||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>2f4ae1ac-5311-483b-ab03-f8bfdf998f29</ProjectGuid>
|
|
||||||
<RootNamespace>MessageSender</RootNamespace>
|
|
||||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
|
||||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
|
||||||
<ProduceOutputsOnBuild>True</ProduceOutputsOnBuild>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
|
||||||
</Project>
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<ActiveDebugProfile>console1</ActiveDebugProfile>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
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")]
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"profiles": {
|
|
||||||
"console1": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,92 +0,0 @@
|
||||||
{
|
|
||||||
"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": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue