Question

I am getting this exception:

The maximum number of Send attempts to send the notification was reached!

(only for apple notification) many times every day and keeps blocking the notifications for a period of time, then it continue working. I am not sure what is happening. ServiceException event is catching this exception.

I am using the pushsharp default configuration.

Here is my code:

     string result = null;
     try
     {
        push = new PushBroker();
        //Wire up the events
        push.OnNotificationSent += NotificationSent;
        push.OnChannelException += ChannelException;
        push.OnServiceException += ServiceException;
        push.OnNotificationFailed += NotificationFailed;
        push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
        push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
        push.OnChannelCreated += ChannelCreated;
        push.OnChannelDestroyed += ChannelDestroyed;

        var appleCert = File.ReadAllBytes(apnCert);

        push.RegisterAppleService(new ApplePushChannelSettings(
            apnProduction, appleCert, apnCertPassword));
        LogNotificationForDevice("", "Apple PN registered Successfully", "");

        push.RegisterGcmService(new GcmPushChannelSettings(androidCertToken));
        LogNotificationForDevice("", "Android PN registered Successfully", "");

        var res = new
        {
            status = "Success"
        };
        result = JsonConvert.SerializeObject(res, Formatting.Indented);
    }
    catch (Exception ex)
    {
        var resex = new
        {
            status = "Failure",
            Message = ex.Message
        };
        result = JsonConvert.SerializeObject(resex, Formatting.Indented);

        LogNotificationForDevice("", "Error when trying to initiate the PushBroker", result);
    }

I appreciate your help.

Was it helpful?

Solution

I used this version "PushSharp 2.1.2-beta" and I am not getting this exception anymore.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top