public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken) { // Get current device token var DeviceToken = deviceToken.Description; if (!string.IsNullOrWhiteSpace(DeviceToken)) { DeviceToken = DeviceToken.Trim('<').Trim('>').Replace(" ", ""); } // Get previous device token var oldDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken"); // Has the token changed? if (string.IsNullOrEmpty(oldDeviceToken) || !oldDeviceToken.Equals(DeviceToken)) { var service = new PushService (); service.SaveToken (DeviceToken); service.RegisterToken (); } }
public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken) { // Get current device token var DeviceToken = deviceToken.Description; if (!string.IsNullOrWhiteSpace(DeviceToken)) { DeviceToken = DeviceToken.Trim('<').Trim('>').Replace(" ", ""); } // Get previous device token var oldDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken"); // Has the token changed? if (string.IsNullOrEmpty(oldDeviceToken) || !oldDeviceToken.Equals(DeviceToken)) { var service = new PushService(); service.SaveToken(DeviceToken); service.RegisterToken(); } }