protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            SharedPush.Initialize();

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button>(Resource.Id.myButton);

            button.Click += delegate
            {
                button.Text = $"{count++} clicks!";
                System.Diagnostics.Debug.WriteLine("Button clicked");
            };

            Switch consentButton = FindViewById <Switch>(Resource.Id.consentSwitch);

            consentButton.CheckedChange += (o, e) =>
            {
                SharedPush.ConsentStatusChanged(consentButton.Checked);
                System.Diagnostics.Debug.WriteLine("Changing consent state");
            };

            consentButton.Checked = SharedPush.UserDidProvideConsent();
        }
Beispiel #2
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            SharedPush.Initialize();

            return(true);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            SharedPush.Initialize();

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button>(Resource.Id.myButton);

            button.Click += delegate
            {
                button.Text = $"{count++} clicks!";
                System.Diagnostics.Debug.WriteLine("Button clicked");
            };

            Switch consentButton = FindViewById <Switch>(Resource.Id.consentSwitch);

            consentButton.CheckedChange += (o, e) =>
            {
                SharedPush.ConsentStatusChanged(consentButton.Checked);

                System.Diagnostics.Debug.WriteLine("Changing consent state");
            };

            consentButton.Checked = OneSignal.Default.PrivacyConsent;

            Button setExternalIdButton = FindViewById <Button>(Resource.Id.setExternalIdButton);

            TextView externalIdField = FindViewById <TextView>(Resource.Id.externalIdField);

            setExternalIdButton.Click += delegate
            {
                OneSignal.Default.SetExternalUserId(externalIdField.Text);
            };

            Button removeExternalIdButton = FindViewById <Button>(Resource.Id.removeExternalIdButton);

            removeExternalIdButton.Click += delegate
            {
                OneSignal.Default.RemoveExternalUserId();
            };
        }
Beispiel #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            SharedPush.Initialize();

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button>(Resource.Id.myButton);

            button.Click += delegate
            {
                button.Text = $"{count++} clicks!";
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Main);

            SharedPush.Initialize();

            Switch pushSwitch = FindViewById <Switch>(Resource.Id.pushSwitch);


            pushSwitch.CheckedChange += delegate
            {
                if (pushSwitch.Checked)
                {
                    SharedPush.Subscribe();
                }
                else
                {
                    SharedPush.Unsubscribe();
                }
            };
        }