public override void ViewDidAppear(bool animated)
 {
     base.ViewDidAppear(animated);
     AnalyticsEnabledSwitch.On      = Analytics.IsEnabledAsync().Result;
     AnalyticsEnabledSwitch.Enabled = MobileCenter.IsEnabledAsync().Result;
     NumPropertiesLabel.Text        = mEventProperties.Count.ToString();
 }
 void UpdateMobileCenterLabel()
 {
     if (MobileCenterEnabledLabel != null)
     {
         MobileCenterEnabledLabel.Text = MobileCenter.IsEnabledAsync().Result ? TestStrings.MobileCenterEnabledText : TestStrings.MobileCenterDisabledText;
     }
 }
Пример #3
0
 public override void ViewDidAppear(bool animated)
 {
     base.ViewDidAppear(animated);
     MobileCenterEnabledSwitch.On = MobileCenter.IsEnabledAsync().Result;
     LogLevelLabel.Text           = LogLevelNames[MobileCenter.LogLevel];
     LogWriteLevelLabel.Text      = LogLevelNames[mLogWriteLevel];
 }
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            CrashesEnabledSwitchCell.On = await Crashes.IsEnabledAsync();

            CrashesEnabledSwitchCell.IsEnabled = await MobileCenter.IsEnabledAsync();
        }
Пример #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            // Get the ViewPager and set it's PagerAdapter so that it can display items
            var viewPager = FindViewById(Resource.Id.viewpager) as ViewPager;

            viewPager.Adapter = new PagerAdapter(SupportFragmentManager, this);

            // Give the TabLayout the ViewPager
            var tabLayout = FindViewById(Resource.Id.tablayout) as TabLayout;

            tabLayout.SetupWithViewPager(viewPager);

            // Mobile Center integration
            MobileCenterLog.Assert(LogTag, "MobileCenter.LogLevel=" + MobileCenter.LogLevel);
            MobileCenter.LogLevel = LogLevel.Verbose;
            MobileCenterLog.Info(LogTag, "MobileCenter.LogLevel=" + MobileCenter.LogLevel);
            MobileCenterLog.Info(LogTag, "MobileCenter.Configured=" + MobileCenter.Configured);

            // Set event handlers
            Crashes.SendingErrorReport      += SendingErrorReportHandler;
            Crashes.SentErrorReport         += SentErrorReportHandler;
            Crashes.FailedToSendErrorReport += FailedToSendErrorReportHandler;

            // Set callbacks
            Crashes.ShouldProcessErrorReport    = ShouldProcess;
            Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler;

            Distribute.ReleaseAvailable = OnReleaseAvailable;

            MobileCenterLog.Assert(LogTag, "MobileCenter.Configured=" + MobileCenter.Configured);
            MobileCenter.SetLogUrl("https://in-integration.dev.avalanch.es");
            Distribute.SetInstallUrl("http://install.asgard-int.trafficmanager.net");
            Distribute.SetApiUrl("https://asgard-int.trafficmanager.net/api/v0.1");
            MobileCenter.Start("bff0949b-7970-439d-9745-92cdc59b10fe", typeof(Analytics), typeof(Crashes), typeof(Distribute));

            MobileCenter.IsEnabledAsync().ContinueWith(enabled =>
            {
                MobileCenterLog.Info(LogTag, "MobileCenter.Enabled=" + enabled.Result);
            });
            MobileCenter.GetInstallIdAsync().ContinueWith(installId =>
            {
                MobileCenterLog.Info(LogTag, "MobileCenter.InstallId=" + installId.Result);
            });
            Crashes.HasCrashedInLastSessionAsync().ContinueWith(hasCrashed =>
            {
                MobileCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + hasCrashed.Result);
            });
            Crashes.GetLastSessionCrashReportAsync().ContinueWith(report =>
            {
                MobileCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.Exception=" + report.Result?.Exception);
                MobileCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.Throwable=" + report.Result?.AndroidDetails?.Throwable);
            });
        }
        protected override async void UpdateState()
        {
            MobileCenterEnabledSwitch.CheckedChange -= UpdateEnabled;
            MobileCenterEnabledSwitch.Checked        = await MobileCenter.IsEnabledAsync();

            MobileCenterEnabledSwitch.CheckedChange += UpdateEnabled;
            LogLevelLabel.Text      = LogLevelNames[MobileCenter.LogLevel];
            LogWriteLevelLabel.Text = LogLevelNames[mLogWriteLevel];
        }
Пример #7
0
        public App()
        {
            InitializeComponent();
            MainPage = new NavigationPage(new MainPuppetPage());

            MobileCenterLog.Assert(LogTag, "MobileCenter.LogLevel=" + MobileCenter.LogLevel);
            MobileCenter.LogLevel = LogLevel.Verbose;
            MobileCenterLog.Info(LogTag, "MobileCenter.LogLevel=" + MobileCenter.LogLevel);
            MobileCenterLog.Info(LogTag, "MobileCenter.Configured=" + MobileCenter.Configured);

            // set callbacks
            Crashes.ShouldProcessErrorReport    = ShouldProcess;
            Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler;
            Crashes.GetErrorAttachments         = GetErrorAttachments;
            Distribute.ReleaseAvailable         = OnReleaseAvailable;

            MobileCenterLog.Assert(LogTag, "MobileCenter.Configured=" + MobileCenter.Configured);
            MobileCenter.SetLogUrl("https://in-integration.dev.avalanch.es");
            Distribute.SetInstallUrl("http://install.asgard-int.trafficmanager.net");
            Distribute.SetApiUrl("https://asgard-int.trafficmanager.net/api/v0.1");
            RealUserMeasurements.SetRumKey("b1919553367d44d8b0ae72594c74e0ff");
            MobileCenter.Start($"uwp={UwpKey};android={AndroidKey};ios={IosKey}",
                               typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push), typeof(RealUserMeasurements));

            // Need to use reflection because moving this to the Android specific
            // code causes crash. (Unable to access properties before init is called).
            if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.Android)
            {
                if (!Properties.ContainsKey(OthersContentPage.FirebaseEnabledKey))
                {
                    Properties[OthersContentPage.FirebaseEnabledKey] = false;
                }

                if ((bool)Properties[OthersContentPage.FirebaseEnabledKey])
                {
                    typeof(Push).GetRuntimeMethod("EnableFirebaseAnalytics", new Type[0]).Invoke(null, null);
                }
            }

            MobileCenter.IsEnabledAsync().ContinueWith(enabled =>
            {
                MobileCenterLog.Info(LogTag, "MobileCenter.Enabled=" + enabled.Result);
            });
            MobileCenter.GetInstallIdAsync().ContinueWith(installId =>
            {
                MobileCenterLog.Info(LogTag, "MobileCenter.InstallId=" + installId.Result);
            });
            MobileCenterLog.Info(LogTag, "MobileCenter.SdkVersion=" + MobileCenter.SdkVersion);
            Crashes.HasCrashedInLastSessionAsync().ContinueWith(hasCrashed =>
            {
                MobileCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + hasCrashed.Result);
            });
            Crashes.GetLastSessionCrashReportAsync().ContinueWith(report =>
            {
                MobileCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.Exception=" + report.Result?.Exception);
            });
        }
        public void GetEnabled()
        {
            _settingsMock.SetupSequence(settings => settings.GetValue(MobileCenter.EnabledKey, It.IsAny <bool>()))
            .Returns(true).Returns(false);

            Assert.IsTrue(MobileCenter.IsEnabledAsync().Result);
            Assert.IsFalse(MobileCenter.IsEnabledAsync().Result);
            _settingsMock.Verify(settings => settings.GetValue(MobileCenter.EnabledKey, It.IsAny <bool>()),
                                 Times.Exactly(2));
        }
Пример #9
0
        protected override async void UpdateState()
        {
            DistributeEnabledSwitch.CheckedChange -= UpdateEnabled;
            DistributeEnabledSwitch.Enabled        = true;
            DistributeEnabledSwitch.Checked        = await Distribute.IsEnabledAsync();

            DistributeEnabledSwitch.Enabled = await MobileCenter.IsEnabledAsync();

            DistributeEnabledSwitch.CheckedChange += UpdateEnabled;
        }
        protected override async void UpdateState()
        {
            CrashesEnabledSwitch.CheckedChange -= UpdateEnabled;
            CrashesEnabledSwitch.Enabled        = true;
            CrashesEnabledSwitch.Checked        = await Crashes.IsEnabledAsync();

            CrashesEnabledSwitch.Enabled = await MobileCenter.IsEnabledAsync();

            CrashesEnabledSwitch.CheckedChange += UpdateEnabled;
        }
Пример #11
0
        protected override async void UpdateState()
        {
            AnalyticsEnabledSwitch.CheckedChange -= UpdateEnabled;
            AnalyticsEnabledSwitch.Enabled        = true;
            AnalyticsEnabledSwitch.Checked        = await Analytics.IsEnabledAsync();

            AnalyticsEnabledSwitch.Enabled = await MobileCenter.IsEnabledAsync();

            AnalyticsEnabledSwitch.CheckedChange += UpdateEnabled;
            PropertiesCountLabel.Text             = mEventProperties.Count.ToString();
        }
Пример #12
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            var mcEnabled = await MobileCenter.IsEnabledAsync();

            DistributeEnabledSwitchCell.On = await Distribute.IsEnabledAsync();

            DistributeEnabledSwitchCell.IsEnabled = mcEnabled;
            PushEnabledSwitchCell.On = await Push.IsEnabledAsync();

            PushEnabledSwitchCell.IsEnabled = mcEnabled;
        }
        public void SetEnabledSameValue()
        {
            _channelGroupMock.Setup(
                group => group.AddChannel(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <TimeSpan>(), It.IsAny <int>()))
            .Returns(new Mock <IChannelUnit>().Object);
            MobileCenter.Start("appsecret", typeof(MockMobileCenterService));
            MobileCenter.SetEnabledAsync(MobileCenter.IsEnabledAsync().Result).Wait();

            MockMobileCenterService.Instance.MockInstance.VerifySet(
                service => service.InstanceEnabled = It.IsAny <bool>(), Times.Never());
            _settingsMock.Verify(settings => settings.SetValue(MobileCenter.EnabledKey, It.IsAny <bool>()), Times.Never());
            _channelGroupMock.Verify(channelGroup => channelGroup.SetEnabled(It.IsAny <bool>()), Times.Never());
        }
        public void SetEnabledDifferentValueAfterConfigure()
        {
            _channelGroupMock.Setup(
                group => group.AddChannel(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <TimeSpan>(), It.IsAny <int>()))
            .Returns(new Mock <IChannelUnit>().Object);
            MobileCenter.Start("appsecret", typeof(MockMobileCenterService));
            var setVal = !MobileCenter.IsEnabledAsync().Result;

            MobileCenter.SetEnabledAsync(setVal).Wait();

            MockMobileCenterService.Instance.MockInstance.VerifySet(service => service.InstanceEnabled = setVal,
                                                                    Times.Once());
            _settingsMock.Verify(settings => settings.SetValue(MobileCenter.EnabledKey, setVal), Times.Once());
            _channelGroupMock.Verify(channelGroup => channelGroup.SetEnabled(setVal), Times.Once());
        }
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            var mcEnabled = await MobileCenter.IsEnabledAsync();

            DistributeEnabledSwitchCell.On = await Distribute.IsEnabledAsync();

            DistributeEnabledSwitchCell.IsEnabled = mcEnabled;
            PushEnabledSwitchCell.On = await Push.IsEnabledAsync();

            PushEnabledSwitchCell.IsEnabled = mcEnabled;
            if (XamarinDevice.RuntimePlatform == XamarinDevice.Android)
            {
                if (!Application.Current.Properties.ContainsKey(FirebaseEnabledKey))
                {
                    Application.Current.Properties[FirebaseEnabledKey] = false;
                }
                FirebaseAnalyticsEnabledSwitchCell.On = (bool)Application.Current.Properties[FirebaseEnabledKey];
            }
            RumEnabledSwitchCell.On = await RealUserMeasurements.IsEnabledAsync();

            RumEnabledSwitchCell.IsEnabled = mcEnabled;
        }
Пример #16
0
 protected override async void OnAppearing()
 {
     base.OnAppearing();
     LogLevelLabel.Text = LogLevelNames[MobileCenter.LogLevel];
     MobileCenterEnabledSwitchCell.On = await MobileCenter.IsEnabledAsync();
 }
Пример #17
0
 public override void ViewDidAppear(bool animated)
 {
     base.ViewDidAppear(animated);
     DistributeEnabledSwitch.On      = Distribute.IsEnabledAsync().Result;
     DistributeEnabledSwitch.Enabled = MobileCenter.IsEnabledAsync().Result;
 }
 public override void ViewDidAppear(bool animated)
 {
     base.ViewDidAppear(animated);
     CrashesEnabledSwitch.On      = Crashes.IsEnabledAsync().Result;
     CrashesEnabledSwitch.Enabled = MobileCenter.IsEnabledAsync().Result;
 }
        private async void UpdateEnabled(object sender, CompoundButton.CheckedChangeEventArgs e)
        {
            await MobileCenter.SetEnabledAsync(e.IsChecked);

            MobileCenterEnabledSwitch.Checked = await MobileCenter.IsEnabledAsync();
        }
Пример #20
0
 partial void UpdateEnabled()
 {
     MobileCenter.SetEnabledAsync(MobileCenterEnabledSwitch.On).Wait();
     MobileCenterEnabledSwitch.On = MobileCenter.IsEnabledAsync().Result;
 }
 private void UpdateState()
 {
     mobileCenterEnabled.IsChecked = MobileCenter.IsEnabledAsync().Result;
     analyticsEnabled.IsChecked    = Analytics.IsEnabledAsync().Result;
 }