/// <summary> /// OnCreate /// </summary> /// <param name="bundle">Bundle</param> protected override void OnCreate(Bundle bundle) { MainActivity.TabLayoutResource = Resource.Layout.Tabbar; MainActivity.ToolbarResource = Resource.Layout.Toolbar; // プッシュ通知初期化 var notificationHubManager = NotificationHubManager.GetInstance(); var notification = new Services.Implements.Notification(Constant.Push.NotificationHubName, Constant.Push.ListenConnectionString, this); notificationHubManager.SetNotificationHub(notification); base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); this.LoadApplication(new App(new AndroidInitializer())); }
/// <summary> /// This method is invoked when the application has loaded and is ready to run. In this /// method you should instantiate the window, load the UI into it and then make the window /// visible. /// You have 17 seconds to return from this method, or iOS will terminate your application. /// </summary> /// <param name="app">UIApplication</param> /// <param name="options">NSDictionary</param> /// <returns>base.FinishedLaunching</returns> public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); // プッシュ通知初期化 var notificationHubManager = NotificationHubManager.GetInstance(); var notification = new Services.Implements.Notification(Constant.Push.ListenConnectionString, Constant.Push.NotificationHubName); notificationHubManager.SetNotificationHub(notification); if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { UNUserNotificationCenter.Current.RequestAuthorization( UNAuthorizationOptions.Alert | UNAuthorizationOptions.Sound | UNAuthorizationOptions.Sound, (granted, error) => { if (granted) { InvokeOnMainThread(UIApplication.SharedApplication.RegisterForRemoteNotifications); } }); } else if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var pushSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, new NSSet()); UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings); UIApplication.SharedApplication.RegisterForRemoteNotifications(); } else { UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound; UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes); } this.LoadApplication(new App(new iOSInitializer())); return(base.FinishedLaunching(app, options)); }
public void SetUp() { this.authHelper = new Mock <IAuthHelper>(); this.notificationHubManager = NotificationHubManager.GetInstance(); }
public void SetUp() { this.notificationHubManager = NotificationHubManager.GetInstance(); this.notificationHub = new Mock <INotificationHub>(); }