Example #1
0
        private async Task PushNotifyInboxMessageGoogleAsync(InboxEntity inbox)
        {
            if (!string.IsNullOrEmpty(inbox.GoogleCloudMessagingRegistrationId))
            {
                var notifications = new GooglePushNotifications(this.HttpClient, ConfigurationManager.AppSettings["GoogleApiKey"], inbox.GoogleCloudMessagingRegistrationId);

                bool invalidChannel = false;
                try
                {
                    bool successfulPush = await notifications.PushGoogleRawNotificationAsync(CancellationToken.None);

                    invalidChannel |= !successfulPush;
                }
                catch (HttpRequestException)
                {
                    invalidChannel = true;
                }

                if (invalidChannel)
                {
                    inbox.GoogleCloudMessagingRegistrationId = null;
                    this.InboxTable.UpdateObject(inbox);
                }
            }
        }
Example #2
0
        private async Task PushNotifyInboxMessageGoogleAsync(InboxEntity inbox)
        {
            if (!string.IsNullOrEmpty(inbox.GoogleCloudMessagingRegistrationId))
            {
                var notifications = new GooglePushNotifications(this.HttpClient, ConfigurationManager.AppSettings["GoogleApiKey"], inbox.GoogleCloudMessagingRegistrationId);

                bool invalidChannel = false;
                try
                {
                    bool successfulPush = await notifications.PushGoogleRawNotificationAsync(CancellationToken.None);
                    invalidChannel |= !successfulPush;
                }
                catch (HttpRequestException)
                {
                    invalidChannel = true;
                }

                if (invalidChannel)
                {
                    inbox.GoogleCloudMessagingRegistrationId = null;
                    this.InboxTable.UpdateObject(inbox);
                }
            }
        }