0

I am using push sharp in a ASP.NET web api server. on my local computer everything works like a charm for GCM and APNS but once uploaded to azure only the GCM messages work. the APNS is not working, not throwing exceptions nothing. I have traces in every event the push broker throws but no trace message is called. not even the message queued...

Here is my initialization code:

 public PushNotificationManager()
        {
            _pushService = new PushBroker();
            _pushService.OnChannelCreated += OnChannelCreated;
            _pushService.OnChannelDestroyed += OnChannelDestroyed;
            _pushService.OnChannelException += OnChannelException;
            _pushService.OnDeviceSubscriptionChanged += OnDeciveSubscriptionChanged;
            _pushService.OnDeviceSubscriptionExpired += OnDeviceSubscriptionExpired;
            _pushService.OnNotificationFailed += OnNorificationFailed;
            _pushService.OnNotificationRequeue += OnNotificationQueued;
            _pushService.OnNotificationSent += OnNOtificationSend;
            _pushService.OnServiceException += OnServiceException;
            InitAndroidPushService();
            InitApplePushService();
        }

        private void InitApplePushService()
        {
            try
            {

                string appDataPath = HttpContext.Current.Server.MapPath("~/app_data");
                //***** Development Server *****//
                //string file = Path.Combine(appDataPath, "PushSharp.PushCert.Development.p12");
                //var appleCert = File.ReadAllBytes(file);
               // _applePushService = new ApplePushService(new ApplePushChannelSettings(false, appleCert, "XXXXXXX"));
                //***** Production Server *****//
                string file = Path.Combine(appDataPath, "PushSharp.PushCert.Production.p12"); 
                var appleCert = File.ReadAllBytes(file);
                _pushService.RegisterAppleService(new ApplePushChannelSettings(true, appleCert, "XXXXXX"));
                Trace.TraceInformation("ApplePushService initialized succesfully");
            }
            catch (Exception e)
            {
                Trace.TraceError("Error initializing ApplePushService : " + e);
                throw;
            }
        }

        private void InitAndroidPushService()
        {
            try
            {
                _pushService.RegisterGcmService(new GcmPushChannelSettings("XXXXXX", "XXXXXX",
                                                                     "XXXXX"));
                Trace.TraceInformation("GooglePushService initialized succesfully");
            }
            catch (Exception e)
            {
                Trace.TraceError("Error initializing AndroidPushService : " + e);

            }
        }

Has anyone enountered such a thing?

Amit Raz
  • 5,370
  • 8
  • 36
  • 63

0 Answers0