public IsTokenSubscribed ( string token ) : bool | ||
token | string | |
return | bool |
private string ProcessUpdate(string oldToken, string newToken, long userId, DeviceType deviceType, ApplicationType?appType) { try { IPushNotificationService notificationSrv = new DefaultPushNotificationService(); if (notificationSrv.IsTokenSubscribed(oldToken)) { if (!newToken.Equals(oldToken)) { notificationSrv.RefreshDeviceToken(oldToken, newToken); logger.InfoFormat("Device token {0} successfully updated with new token {1}", oldToken, newToken); return(string.Format("Device token {0} successfully updated with new token {1}", oldToken, newToken)); } } else if (!notificationSrv.IsTokenSubscribed(newToken)) { notificationSrv.SubscribeDeviceToken(newToken, deviceType, userId, appType); return(string.Format("New device token {0} successfully inserted in database", newToken)); } return(null); } 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); } }
/// <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); } }
private string ProcessUpdate(string oldToken, string newToken, long userId, DeviceType deviceType, ApplicationType? appType) { try { IPushNotificationService notificationSrv = new DefaultPushNotificationService(); if (notificationSrv.IsTokenSubscribed(oldToken)) { if (!newToken.Equals(oldToken)) { notificationSrv.RefreshDeviceToken(oldToken, newToken); logger.InfoFormat("Device token {0} successfully updated with new token {1}", oldToken, newToken); return string.Format("Device token {0} successfully updated with new token {1}", oldToken, newToken); } } else if (!notificationSrv.IsTokenSubscribed(newToken)) { notificationSrv.SubscribeDeviceToken(newToken, deviceType, userId, appType); return string.Format("New device token {0} successfully inserted in database", newToken); } return null; } 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); } }
/// <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); } }