public RefreshDeviceToken ( string oldId, string newId ) : void | ||
oldId | string | |
newId | string | |
return | void |
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 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); } }