Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Main);
            messageView = FindViewById <TextView>(Resource.Id.MessageView);

            if (string.IsNullOrEmpty(DemoParameters.MobileKey))
            {
                SetMessage(DemoMessages.MobileKeyNotSet);
            }
            else
            {
                client = LdClient.Init(
                    // These values are set in the Shared project
                    DemoParameters.MobileKey,
                    DemoParameters.MakeDemoUser(),
                    DemoParameters.SDKTimeout
                    );
                if (client.Initialized)
                {
                    UpdateFlagValue();
                    client.FlagTracker.FlagValueChanged += FeatureFlagChanged;
                }
                else
                {
                    SetMessage(DemoMessages.InitializationFailed);
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            if (string.IsNullOrEmpty(DemoParameters.MobileKey))
            {
                ShowMessage(DemoMessages.MobileKeyNotSet);
                Environment.Exit(1);
            }

            LdClient client = LdClient.Init(
                DemoParameters.MobileKey,
                DemoParameters.MakeDemoUser(),
                DemoParameters.SDKTimeout
                );

            if (client.Initialized)
            {
                ShowMessage(DemoMessages.InitializationSucceeded);
            }
            else
            {
                ShowMessage(DemoMessages.InitializationFailed);
                Environment.Exit(1);
            }

            var flagValue = client.BoolVariation(DemoParameters.FeatureFlagKey, false);

            ShowMessage(string.Format(DemoMessages.FlagValueIs, DemoParameters.FeatureFlagKey, flagValue));

            // Here we ensure that the SDK shuts down cleanly and has a chance to deliver analytics
            // events to LaunchDarkly before the program exits. If analytics events are not delivered,
            // the user properties and flag usage statistics will not appear on your dashboard. In a
            // normal long-running application, the SDK would continue running and events would be
            // delivered automatically in the background.
            client.Dispose();
        }
Exemplo n.º 3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (string.IsNullOrEmpty(DemoParameters.MobileKey))
            {
                SetMessage(DemoMessages.MobileKeyNotSet);
            }
            else
            {
                client = LdClient.Init(
                    DemoParameters.MobileKey,
                    DemoParameters.MakeDemoUser(),
                    DemoParameters.SDKTimeout
                    );
                if (client.Initialized)
                {
                    UpdateFlagValue();
                    client.FlagTracker.FlagValueChanged += FeatureFlagChanged;
                }
                else
                {
                    SetMessage(DemoMessages.InitializationFailed);
                }
            }
        }