diff --git a/sendmsg/NuGet.Config b/sendmsg/NuGet.Config new file mode 100755 index 00000000..e80222c1 --- /dev/null +++ b/sendmsg/NuGet.Config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/sendmsg/Program.cs b/sendmsg/Program.cs index 60291ee6..48986dc5 100644 --- a/sendmsg/Program.cs +++ b/sendmsg/Program.cs @@ -14,12 +14,27 @@ namespace MessageSender static void Main(string[] args) { + var reg_id= "eRSVBXTxiyk:APA91bE1NRs6LWBq9O3ACBV5g4B8D2ANwS9UjpPkwYFYWtv6NeTuSzBb6ZBhOFx_gbh9AbSgZ7uHETOPp26ahhJY74i55f7gULgaQR7-MV5CeaBYANfKcVgqQ5GTsb2zMCS_2MIUVy3Q"; var jGcmData = new JObject(); - var jData = 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); - jData.Add("message", MESSAGE); +/* "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 @@ -33,7 +48,7 @@ namespace MessageSender "Authorization", "key=" + API_KEY); Task.WaitAll(client.PostAsync(url, - new StringContent(jGcmData.ToString(), Encoding.Default, "application/json")) + new StringContent(jGcmData.ToString(), Encoding.UTF8, "application/json")) .ContinueWith(response => { Task.Run ( async () => { diff --git a/sendmsg/project.json b/sendmsg/project.json index 9fadf190..b749afe9 100644 --- a/sendmsg/project.json +++ b/sendmsg/project.json @@ -1,30 +1,28 @@ { "version": "1.0.0-*", + "description": "ConsoleApplication Console Application", + "authors": [ + "" + ], + "tags": [ + "" + ], + "projectUrl": "", + "licenseUrl": "", "compilationOptions": { "emitEntryPoint": true }, "tooling": { - "defaultNamespace": "sendmsg" + "defaultNamespace": "ConsoleApplication" }, "dependencies": { - "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final", - "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final", - "System.Net.Http": "4.1.0", - "Newtonsoft.Json": "9.0.1" + "Newtonsoft.Json": "9.0.1", + "System.Net.Http": "4.1.0" }, "commands": { - "web": "Microsoft.AspNet.Server.Kestrel" + "ConsoleApplication": "ConsoleApplication" }, "frameworks": { - "dnx451": {}, - "dnxcore50": {} - }, - "exclude": [ - "wwwroot", - "node_modules" - ], - "publishExclude": [ - "**.user", - "**.vspscc" - ] -} \ No newline at end of file + "dnx451": {} + } +}