public override void OnCreate()
        {
            var options = AirshipConfigOptions.LoadDefaultOptions(this);

            // Optionally, customize your config
            options.InProduction         = false;
            options.DevelopmentAppKey    = "";
            options.DevelopmentAppSecret = "";

            UAirship.TakeOff(this, options);

            //use CustomPushNotificationBuilder to specify a custom layout
            CustomPushNotificationBuilder nb = new CustomPushNotificationBuilder();

            nb.StatusBarIconDrawableId = Resource.Id.icon;            //custom status bar icon

            nb.Layout = Resource.Layout.notification;
            nb.LayoutIconDrawableId = Resource.Id.icon;            //custom layout icon
            nb.LayoutIconId         = Resource.Id.icon;
            nb.LayoutSubjectId      = Resource.Id.subject;
            nb.LayoutMessageId      = Resource.Id.message;

            PushManager.Shared().NotificationBuilder  = nb;
            PushManager.Shared().IntentReceiver       = Class.FromType(typeof(IntentReceiver));
            UALocationManager.Shared().IntentReceiver = Class.FromType(typeof(IntentReceiver));
        }
Exemplo n.º 2
0
        public override void OnCreate()
        {
            base.OnCreate();

            UAirship.TakeOff(this, (UAirship airship) => {
                airship.PushManager.UserNotificationsEnabled = true;
                airship.PushManager.Tags = new String[] { "android-xamarin" };
            });
        }
Exemplo n.º 3
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Bootstrap the Urban Airship SDK
            UAirship.TakeOff();

            // Enable visible push notifications
            UAirship.Push.UserPushNotificationsEnabled = true;

            return(true);
        }
        public override void OnCreate()
        {
            UAirship.TakeOff(this);
            PushManager.Shared().IntentReceiver = Class.FromType(typeof(PushReceiver));
            RichPushManager.SetJavascriptInterface(Class.FromType(typeof(RichPushMessageJavaScript)), "urbanairship");

            // If running on Jelly Bean or higher, then use the inbox style notification builder
            if ((int)Build.VERSION.SdkInt >= (int)BuildVersionCodes.JellyBean)
            {
                PushManager.Shared().NotificationBuilder = new RichNotificationBuilder();
            }
        }
Exemplo n.º 5
0
        public override void OnCreate()
        {
            UAirship.TakeOff(this);
            //PushManager.Shared ().IntentReceiver = Java.Lang.Class.FromType (typeof(IntentReceiver));
            RichPushManager.SetJavascriptInterface(Java.Lang.Class.FromType(typeof(RichPushMessageJavaScript)), "urbanairship");

            /*
             * // If running on Jelly Bean or higher, then use the inbox style notification builder
             * if (Build.VERSION.SdkInt >= 16) {
             *      PushManager.Shared().NotificationBuilder = new RichNotificationBuilder ();
             * }
             */
        }
Exemplo n.º 6
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // Set log level for debugging config loading (optional)
            // It will be set to the value in the loaded config upon takeOff
            UAirship.LogLevel = 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())
            {
                throw new RuntimeException("The AirshipConfig.plist must be a part of the app bundle and " +
                                           "include a valid appkey and secret for the selected production level.");
            }

            WarnIfSimulator();

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

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

            UAirship.Push.ResetBadge();

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

            UNNotificationAction sampleAction = UNNotificationAction.FromIdentifier("sampleAction", title: "Sample Action Title", options: UNNotificationActionOptions.Destructive);

            var sampleActions     = new UNNotificationAction[] { sampleAction };
            var intentIdentifiers = new string[] { };

            // Create category for sample content extension
            UNNotificationCategory[]       SampleCategoryArray = { UNNotificationCategory.FromIdentifier("sample-extension-category", actions: sampleActions, intentIdentifiers: intentIdentifiers, options: UNNotificationCategoryOptions.None) };
            NSSet <UNNotificationCategory> categories          = new NSSet <UNNotificationCategory>(SampleCategoryArray);

            // Add sample content extension category to Airship custom categories
            UAirship.Push.CustomCategories = categories;

            UAirship.Push.WeakRegistrationDelegate = this;

            NSNotificationCenter.DefaultCenter.AddObserver(new NSString("channelIDUpdated"), (notification) =>
            {
                //FIXME: Find a way to call the refreshView from the HomeViewController
            });

            InitFormsApp();

            return(base.FinishedLaunching(app, options));
        }
Exemplo n.º 7
0
        //
        // 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.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            viewController            = new UrbanAirshipPushNotificationsViewController();
            window.RootViewController = viewController;
            window.MakeKeyAndVisible();

            options = new NSDictionary();
            var takeOffOptions = new NSMutableDictionary();

            takeOffOptions.SetValueForKey(options, new NSString("UAirshipTakeOffOptionsLaunchOptionsKey"));

            UAPush.Shared.ResetBadge();
            UAirship.TakeOff(takeOffOptions);

            return(true);
        }
Exemplo n.º 8
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);
        }