Subscribe() public method

Subscribe user to get push message
public Subscribe ( string deviceToken, DeviceType deviceType, string accessToken, ApplicationType appType ) : void
deviceToken string
deviceType DeviceType
accessToken string
appType ApplicationType
return void
Example #1
0
        private void ProcessSubscribe(string newToken, DeviceType deviceType, string accessToken, ApplicationType?appType)
        {
            try
            {
                IPushNotificationService notificationSrv = new DefaultPushNotificationService();

                if (!notificationSrv.IsTokenSubscribed(newToken))
                {
                    notificationSrv.Subscribe(newToken, deviceType, accessToken, appType);
                }
                else
                {
                    throw new ApplicationException("Device already subscribed");
                }
            }
            catch (Exception e)
            {
                throw new ApplicationException(e.Message);
            }
        }
        private void ProcessSubscribe(string newToken, DeviceType deviceType, string accessToken, ApplicationType? appType)
        {
            try
            {
                IPushNotificationService notificationSrv = new DefaultPushNotificationService();

                if (!notificationSrv.IsTokenSubscribed(newToken))
                    notificationSrv.Subscribe(newToken, deviceType, accessToken, appType);
                else
                    throw new ApplicationException("Device already subscribed");
            }
            catch (Exception e)
            {
                throw new ApplicationException(e.Message);
            }
        }