Send() публичный Метод

Sends push message to subscribed user device
public Send ( System.Int64 userId, DeviceType deviceType, string token, string message, ApplicationType appType ) : void
userId System.Int64
deviceType DeviceType
token string
message string
appType ApplicationType
Результат void
Пример #1
0
        /// <summary>
        /// Subscribes push notifications
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="token"></param>
        /// <param name="deviceType"></param>

        public void SubscribePushNotification(string token, DeviceType deviceType, SendInfo info, ApplicationType?appType)
        {
            try
            {
                IPushNotificationService notificationService = new DefaultPushNotificationService();

                if (notificationService.IsTokenSubscribed(token) == false)
                {
                    notificationService.SubscribeDeviceToken(token, deviceType, info.Id, appType);
                    notificationService.Send(info.Id, deviceType, token, Options.NotificationMessage, appType);
                }
                else
                {
                    throw new ApplicationException("Device already subscribed");
                }
            }
            catch (Exception e)
            {
                throw new ApplicationException(e.Message);
            }
        }
        /// <summary>
        /// Subscribes push notifications
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="token"></param>
        /// <param name="deviceType"></param>
        public void SubscribePushNotification(string token, DeviceType deviceType, SendInfo info, ApplicationType? appType)
        {
            try
            {
                IPushNotificationService notificationService = new DefaultPushNotificationService();

                if (notificationService.IsTokenSubscribed(token) == false)
                {
                    notificationService.SubscribeDeviceToken(token, deviceType, info.Id, appType);
                    notificationService.Send(info.Id, deviceType, token, Options.NotificationMessage, appType);
                }
                else
                    throw new ApplicationException("Device already subscribed");
            }
            catch (Exception e)
            {
                throw new ApplicationException(e.Message);
            }
        }