public async override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken) { if (string.IsNullOrWhiteSpace(Settings.UserDeviceId)) { return; } var registrationId = deviceToken.Description; if (!string.IsNullOrWhiteSpace(registrationId)) { registrationId = registrationId.Trim('<').Trim('>').Replace(" ", ""); } if (Settings.NotificationRegId != registrationId) { Settings.NotificationRegId = registrationId; try { var manager = new DeviceRegistrationManager(); await manager.RegisterAsync(Settings.NotificationRegId, new string[] { "username:" + Settings.UserDeviceId }, PlatformType.iOS, null); } catch (Exception ex) { App.Logger.Report(ex); } } }
protected async override void OnRegistered(Context context, string registrationId) { //Receive registration Id for sending GCM Push Notifications to if (registrationId != Settings.NotificationRegId) { Settings.NotificationRegId = registrationId; try{ var manager = new DeviceRegistrationManager(); await manager.RegisterAsync(Settings.NotificationRegId, new string[] { "username:" + Settings.UserDeviceId }, PlatformType.Android, null); }catch (Exception ex) { App.Logger.Report(ex); } } }