Exemplo n.º 1
0
 void reloadData()
 {
     Accengage.GetInbox((arg1) => {
         inbox = arg1;
         updateUIandData();
     });
 }
Exemplo n.º 2
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Enable logs
            Accengage.SetLoggingEnabled(true);

            Accengage.Start();

            // Register for notification
            AccengageIOS.ACCNotificationOptions options = (AccengageIOS.ACCNotificationOptions.Alert | AccengageIOS.ACCNotificationOptions.Badge | AccengageIOS.ACCNotificationOptions.Sound);
            AccengageIOS.Accengage.Push.RegisterForUserNotificationsWithOptions(options);

            // Enable Geofence service if needed
            AccengageIOS.BMA4SLocationServices.SetGeofenceServiceEnabled(SampleHelpers.isGeofenceServiceEnabled());

            // Enable Beacon service if needed
            AccengageIOS.BMA4SLocationServices.SetBeaconServiceEnabled(SampleHelpers.isBeaconServiceEnabled());

            //init géoloc
            locationManager                 = new CLLocationManager();
            locationManager.Delegate        = new LocationManagerDelegate();
            locationManager.DistanceFilter  = CLLocationDistance.FilterNone;
            locationManager.DesiredAccuracy = CLLocation.AccuracyBest;
            locationManager.RequestAlwaysAuthorization();
            locationManager.StartUpdatingLocation();

            AccPushSource = new AccPushDelegate(this);
            AccengageIOS.Accengage.Push.Delegate = AccPushSource;

            return(true);
        }
        partial void LikeButton_Activated(UIBarButtonItem sender)
        {
            Accengage.TrackLead("Facebook", "like");

            SCLAlertView alert = new SCLAlertView();

            alert.ShowSuccess(this.ParentViewController, "Thank you!", "Thanks for liking us on Facebook!", "Close", 3.0f);
        }
        bool statusForIndex(int index)
        {
            switch (index)
            {
            case 1:
                return(Accengage.IsInAppDisplayDisabled());

            case 2:
                return(SampleHelpers.isBeaconServiceEnabled());

            case 3:
                return(SampleHelpers.isGeofenceServiceEnabled());
            }
            return(false);
        }
        void setStatusForIndex(bool status, int index)
        {
            Console.WriteLine(status);
            switch (index)
            {
            case 1:
                Accengage.SetInAppDisplayDisabled(status);
                break;

            case 2:
                SampleHelpers.setBeaconServiceEnabled(status);
                break;

            case 3:
                SampleHelpers.setGeofenceServiceEnabled(status);
                break;
            }
        }
Exemplo n.º 6
0
            public override void LocationsUpdated(CLLocationManager manager, CLLocation[] locations)
            {
                // do not update with old location
                CLLocation newLocation = locations[locations.Length - 1];
                var        locationAge = (DateTime)NSDate.Now - (DateTime)newLocation.Timestamp;

                if (locationAge.TotalSeconds > 5)
                {
                    return;
                }

                // test that the horizontal accuracy does not indicate an invalid measurement
                if (newLocation.HorizontalAccuracy < 0)
                {
                    return;
                }

                Accengage.UpdateGeolocation(newLocation);
            }
        void setUserName()
        {
            SCLAlertView alert = editionAlertView();

            UITextField textField = alert.AddTextField("User name");

            alert.AddButton("Send", () =>
            {
                string text = textField.Text;
                NSUserDefaults.StandardUserDefaults.SetValueForKey(new NSString(text), new NSString("user.name"));
                var list = new List <KeyValuePair <string, string> >();
                list.Add(new KeyValuePair <string, string>("user_name", text));
                Accengage.UpdateDeviceInfo(list);
            });

            var    name     = NSUserDefaults.StandardUserDefaults.ValueForKey(new NSString("user.name"));
            string subtitle = (name != null) ? "The current name is: " + name : "";

            alert.ShowEdit(this.ParentViewController, "User's name", subtitle, "cancel", 0);
        }
Exemplo n.º 8
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            SCLAlertView alert     = new SCLAlertView();
            UITextField  textField = alert.AddTextField("Enter the quantity");

            textField.KeyboardType = UIKeyboardType.NumberPad;

            UITextField textField2 = alert.AddTextField("Enter the price");

            textField2.KeyboardType = UIKeyboardType.NumberPad;

            alert.ShouldDismissOnTapOutside = true;
            alert.CustomViewColor           = UIColor.FromRGB(44, 147, 255);
            alert.HideAnimationType         = SCLAlertViewHideAnimation.FadeOut;
            alert.ShowAnimationType         = SCLAlertViewShowAnimation.FadeIn;

            alert.AddButton("Send", () => {
                if (textField.Text != "" && textField2.Text != "")
                {
                    Console.WriteLine("Text Value: " + textField.Text);

                    Int32 quantity = Int32.Parse(textField.Text);
                    Double price   = Double.Parse(textField2.Text);

                    string product = "Product " + indexPath.Row.ToString();
                    AccengageItem accengageItem = new AccengageItem(product, "Brand", "Product", price, "EUR", quantity);

                    List <AccengageItem> listItem = new List <AccengageItem>();
                    listItem.Add(accengageItem);

                    Accengage.TrackPurchase("dePurchase", "EUR", quantity * price, listItem);
                }
            });

            alert.ShowEdit(this.ParentViewController, "How much ?", "", "Cancel", 0);

            TableView.DeselectRow(indexPath, true);
        }
Exemplo n.º 9
0
        public override void ViewDidDisappear(bool animated)
        {
            base.ViewDidDisappear(animated);

            Accengage.TrackScreenDismiss("Product");
        }
Exemplo n.º 10
0
 protected override void OnPause()
 {
     base.OnPause();
     Accengage.StopActivity(this);
 }
Exemplo n.º 11
0
 protected override void OnNewIntent(Intent intent)
 {
     base.OnNewIntent(intent);
     Accengage.SetIntent(intent);
 }
Exemplo n.º 12
0
 protected override void OnResume()
 {
     base.OnResume();
     Accengage.StartActivity(this);
 }
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            Accengage.TrackScreenDisplay("SETTINGS");
        }
Exemplo n.º 14
0
 protected override void OnResume()
 {
     base.OnResume();
     Accengage.GetInbox(LoadMessages);
 }
Exemplo n.º 15
0
 public override void OnCreate()
 {
     base.OnCreate();
     Accengage.SetContext(this);
 }