diff --git a/PushSharp.Android/Gcm/GcmPushChannel.cs b/PushSharp.Android/Gcm/GcmPushChannel.cs index b3a44e24..b190627b 100644 --- a/PushSharp.Android/Gcm/GcmPushChannel.cs +++ b/PushSharp.Android/Gcm/GcmPushChannel.cs @@ -51,6 +51,7 @@ public void SendNotification(INotification notification, SendNotificationCallbac //var postData = msg.GetJson(); var webReq = (HttpWebRequest)WebRequest.Create(gcmSettings.GcmUrl); + ConfigureProxy (webReq); //webReq.ContentLength = postData.Length; webReq.Method = "POST"; webReq.ContentType = "application/json"; @@ -70,6 +71,14 @@ public void SendNotification(INotification notification, SendNotificationCallbac }); } + void ConfigureProxy(HttpWebRequest request) + { + if (gcmSettings.Proxy != null) + { + request.Proxy = gcmSettings.Proxy; + } + } + void requestStreamCallback(IAsyncResult result) { var asyncParam = result.AsyncState as GcmAsyncParameters; diff --git a/PushSharp.Android/Gcm/GcmPushChannelSettings.cs b/PushSharp.Android/Gcm/GcmPushChannelSettings.cs index ac525f56..54ea7ba0 100644 --- a/PushSharp.Android/Gcm/GcmPushChannelSettings.cs +++ b/PushSharp.Android/Gcm/GcmPushChannelSettings.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Text; using PushSharp.Core; +using System.Net; namespace PushSharp.Android { @@ -31,6 +32,7 @@ public GcmPushChannelSettings(string optionalSenderID, string senderAuthToken, s public string SenderID { get; private set; } public string SenderAuthToken { get; private set; } public string ApplicationIdPackageName { get; private set; } + public WebProxy Proxy { get; set; } public bool ValidateServerCertificate { get; set; }