Пример #1
0
    // Events



    //this even raised when a notification is successfully sent
    public static void NotificationSucceeded(PushSharp.Apple.ApnsNotification Notification)
    {
        MyWebEntryPoint mw = new MyWebEntryPoint(null);

        //mw.HandleRequest(null, null);
        PushAppEvents.ONNotificationSucceeded(Notification, mw, mw.getIMDB());
        mw.CloseAllDBConnections();
    }
Пример #2
0
    // //this is raised when a notification is failed due to some reason
    public static void NotificationFailed(PushSharp.Apple.ApnsNotification Notification, Exception exception)
    {
        MyWebEntryPoint mw = new MyWebEntryPoint(null);

        //mw.HandleRequest(null, null);
        com.progamma.IDVariant ErrorMessage = new com.progamma.IDVariant();
        ErrorMessage.set(new com.progamma.IDVariant(exception.InnerException.Message.ToString()));
        PushAppEvents.ONNotificationFailed(Notification, ErrorMessage, mw, mw.getIMDB());
        mw.CloseAllDBConnections();
    }
Пример #3
0
 public CompletableApnsNotification(ApnsNotification notification)
 {
     Notification     = notification;
     completionSource = new TaskCompletionSource <Exception> ();
 }
Пример #4
0
 public ApnsNotificationException(ApnsNotificationErrorStatusCode errorStatusCode, ApnsNotification notification, Exception innerException)
     : base("Apns notification error: '" + errorStatusCode + "'", notification, innerException)
 {
     Notification    = notification;
     ErrorStatusCode = errorStatusCode;
 }
Пример #5
0
 public ApnsNotificationException(byte errorStatusCode, ApnsNotification notification)
     : this(ToErrorStatusCode(errorStatusCode), notification)
 {
 }
Пример #6
0
 public CompletableApnsNotification (ApnsNotification notification)
 {
     Notification = notification;
     completionSource = new TaskCompletionSource<Exception> ();
 }
Пример #7
0
        private void ApnsBroker_OnNotificationFailed(ApnsNotification notification, AggregateException exception)
        {
            exception.Handle(ex =>
            {
                // See what kind of exception it was to further diagnose
                if(ex is ApnsNotificationException)
                {
                    var notificationException = ex as ApnsNotificationException;

                    // Deal with the failed notification
                    var apnsNotification = notificationException.Notification;
                    var statusCode = notificationException.ErrorStatusCode;

                    Debug.WriteLine($"Apple Notification Failed: ID={apnsNotification.Identifier}, Code={statusCode}");
                }
                else
                {
                    // Inner exception might hold more useful information like an ApnsConnectionException
                    Debug.WriteLine($"Apple Notification Failed for some unknown reason : {ex.InnerException}");
                }

                // Mark it as handled
                return true;
            });
        }
Пример #8
0
 public ApnsNotificationException (ApnsNotificationErrorStatusCode errorStatusCode, ApnsNotification notification, Exception innerException)
     : base ("Apns notification error: '" + errorStatusCode + "'", notification, innerException)
 {
     Notification = notification;
     ErrorStatusCode = errorStatusCode;
 }
Пример #9
0
 public ApnsNotificationException(byte errorStatusCode, ApnsNotification notification)
     : this(ToErrorStatusCode(errorStatusCode), notification)
 { }
Пример #10
0
 public ApnsNotificationException(ApnsNotificationErrorStatusCode errorStatusCode, ApnsNotification notification)
     : base($"Apns notification error: '{errorStatusCode}'")
 {
     Notification    = notification;
     ErrorStatusCode = errorStatusCode;
 }