Merge branch 'vnext' of https://github.com/pazof/yavsc into vnext
* 'vnext' of https://github.com/pazof/yavsc: (38 commits) fixe le premier démarrage Corrige le mot de passe perdu d'un utilisateur au nom contenant des espaces traductions fixe la reccupération du mot de passe refabrique: MEP index blogs Specialized the book query notification Updated the Licence validity cleaned up log warnings label event date cleans the code Adds support for SIREN exceptions to validation from the external provider layout trads refactoring refactoring Google maps: a map image implements an AccessDenied page A better layout ... # Conflicts: # Yavsc.Api/project.lock.json # Yavsc.Client/Yavsc.Client.csproj # Yavsc.Client/packages.config # sendmsg/Program.cs
This commit is contained in:
commit
e3a73e8146
190 changed files with 6664 additions and 763 deletions
9
sendmsg/NuGet.Config
Normal file
9
sendmsg/NuGet.Config
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
|
||||
<clear />
|
||||
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
|
||||
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
69
sendmsg/Program.cs
Normal file
69
sendmsg/Program.cs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
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 reg_id= "eRSVBXTxiyk:APA91bE1NRs6LWBq9O3ACBV5g4B8D2ANwS9UjpPkwYFYWtv6NeTuSzBb6ZBhOFx_gbh9AbSgZ7uHETOPp26ahhJY74i55f7gULgaQR7-MV5CeaBYANfKcVgqQ5GTsb2zMCS_2MIUVy3Q";
|
||||
var jGcmData = new JObject();
|
||||
var jNotification = new JObject();
|
||||
jNotification.Add("body","a body");
|
||||
jNotification.Add("title",MESSAGE);
|
||||
jNotification.Add("icon","icon");
|
||||
jGcmData.Add("to",reg_id);
|
||||
jGcmData.Add("notification",jNotification);
|
||||
|
||||
/* "to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
|
||||
"notification" : {
|
||||
"body" : "great match!",
|
||||
"title" : "Portugal vs. Denmark",
|
||||
"icon" : "myicon"
|
||||
}
|
||||
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.UTF8, "application/json"))
|
||||
.ContinueWith(response =>
|
||||
{
|
||||
Task.Run ( async () => {
|
||||
var content = await response.Result.Content.ReadAsStringAsync();
|
||||
Console.WriteLine(content);
|
||||
});
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
sendmsg/project.json
Normal file
28
sendmsg/project.json
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"description": "ConsoleApplication Console Application",
|
||||
"authors": [
|
||||
""
|
||||
],
|
||||
"tags": [
|
||||
""
|
||||
],
|
||||
"projectUrl": "",
|
||||
"licenseUrl": "",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
"tooling": {
|
||||
"defaultNamespace": "ConsoleApplication"
|
||||
},
|
||||
"dependencies": {
|
||||
"Newtonsoft.Json": "9.0.1",
|
||||
"System.Net.Http": "4.1.0"
|
||||
},
|
||||
"commands": {
|
||||
"ConsoleApplication": "ConsoleApplication"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue