Пример #1
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            this.FailIfSimulator();

            Xamarin.Forms.Forms.Init();

            // Set log level for debugging config loading (optional)
            // It will be set to the value in the loaded config upon takeOff
            UAirship.SetLogLevel(UALogLevel.Trace);

            // Populate AirshipConfig.plist with your app's info from https://go.urbanairship.com
            // or set runtime properties here.
            UAConfig config = UAConfig.DefaultConfig();

            if (!config.Validate())
            {
                this.ShowInvalidConfigAlert();
                return(true);
            }

            config.MessageCenterStyleConfig = "UAMessageCenterDefaultStyle";

            // Bootstrap the Urban Airship SDK
            UAirship.TakeOff(config);

            Console.WriteLine("Config:{0}", config);

            UAirship.Push.ResetBadge();

            pushHandler = new PushHandler();
            UAirship.Push.PushNotificationDelegate = pushHandler;

            inboxDelegate           = new InboxDelegate(Window.RootViewController);
            UAirship.Inbox.Delegate = inboxDelegate;

            NSString messageListUpdated = new NSString("com.urbanairship.notification.message_list_updated");

            NSNotificationCenter.DefaultCenter.AddObserver(messageListUpdated, (notification) =>
            {
                refreshMessageCenterBadge();
            });

            return(true);
        }