protected override async void OnAppearing() { base.OnAppearing(); var acEnabled = await AppCenter.IsEnabledAsync(); DistributeEnabledSwitchCell.On = await Distribute.IsEnabledAsync(); DistributeEnabledSwitchCell.IsEnabled = acEnabled; PushEnabledSwitchCell.On = await Push.IsEnabledAsync(); PushEnabledSwitchCell.IsEnabled = acEnabled; RumEnabledSwitchCell.On = _rumStarted && await RealUserMeasurements.IsEnabledAsync(); RumEnabledSwitchCell.IsEnabled = acEnabled; EventFilterEnabledSwitchCell.On = _eventFilterStarted && await EventFilterHolder.Implementation?.IsEnabledAsync(); EventFilterEnabledSwitchCell.IsEnabled = acEnabled && EventFilterHolder.Implementation != null; if (userInfo?.AccountId != null) { SignInInformationButton.Text = "User authenticated"; } else { SignInInformationButton.Text = "User not authenticated"; } }
protected override async void OnAppearing() { base.OnAppearing(); var acEnabled = await AppCenter.IsEnabledAsync(); DistributeEnabledSwitchCell.On = await Distribute.IsEnabledAsync(); DistributeEnabledSwitchCell.IsEnabled = acEnabled; PushEnabledSwitchCell.On = await Push.IsEnabledAsync(); PushEnabledSwitchCell.IsEnabled = acEnabled; AuthEnabledSwitchCell.On = await Auth.IsEnabledAsync(); AuthEnabledSwitchCell.IsEnabled = acEnabled; RumEnabledSwitchCell.On = _rumStarted && await RealUserMeasurements.IsEnabledAsync(); RumEnabledSwitchCell.IsEnabled = acEnabled; EventFilterEnabledSwitchCell.On = _eventFilterStarted && await EventFilterHolder.Implementation?.IsEnabledAsync(); EventFilterEnabledSwitchCell.IsEnabled = acEnabled && EventFilterHolder.Implementation != null; if (!Application.Current.Properties.ContainsKey(AccountId)) { SignInInformationButton.Text = "Authentication status unknown"; } else if (Application.Current.Properties[AccountId] is string) { SignInInformationButton.Text = "User is authenticated"; } else { SignInInformationButton.Text = "User is not authenticated"; } }
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); }); }
async void UpdateRumEnabled(object sender, ToggledEventArgs e) { if (!_rumStarted) { RealUserMeasurements.SetRumKey("b1919553367d44d8b0ae72594c74e0ff"); AppCenter.Start(typeof(RealUserMeasurements)); _rumStarted = true; } await RealUserMeasurements.SetEnabledAsync(e.Value); }
protected override async void OnAppearing() { base.OnAppearing(); var acEnabled = await AppCenter.IsEnabledAsync(); DistributeEnabledSwitchCell.On = await Distribute.IsEnabledAsync(); DistributeEnabledSwitchCell.IsEnabled = acEnabled; PushEnabledSwitchCell.On = await Push.IsEnabledAsync(); PushEnabledSwitchCell.IsEnabled = acEnabled; RumEnabledSwitchCell.On = await RealUserMeasurements.IsEnabledAsync(); RumEnabledSwitchCell.IsEnabled = acEnabled; }
protected override async void OnAppearing() { base.OnAppearing(); var acEnabled = await AppCenter.IsEnabledAsync(); DistributeEnabledSwitchCell.On = await Distribute.IsEnabledAsync(); DistributeEnabledSwitchCell.IsEnabled = acEnabled; PushEnabledSwitchCell.On = await Push.IsEnabledAsync(); PushEnabledSwitchCell.IsEnabled = acEnabled; RumEnabledSwitchCell.On = _rumStarted && await RealUserMeasurements.IsEnabledAsync(); RumEnabledSwitchCell.IsEnabled = acEnabled; EventFilterEnabledSwitchCell.On = _eventFilterStarted && await EventFilterHolder.Implementation?.IsEnabledAsync(); EventFilterEnabledSwitchCell.IsEnabled = acEnabled && EventFilterHolder.Implementation != null; }
protected override void OnStart() { AppCenterLog.Assert(LogTag, "AppCenter.LogLevel=" + AppCenter.LogLevel); AppCenter.LogLevel = LogLevel.Verbose; AppCenterLog.Info(LogTag, "AppCenter.LogLevel=" + AppCenter.LogLevel); AppCenterLog.Info(LogTag, "AppCenter.Configured=" + AppCenter.Configured); // Set callbacks Crashes.ShouldProcessErrorReport = ShouldProcess; Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler; Crashes.GetErrorAttachments = GetErrorAttachments; Distribute.ReleaseAvailable = OnReleaseAvailable; AppCenterLog.Assert(LogTag, "AppCenter.Configured=" + AppCenter.Configured); AppCenter.SetLogUrl("https://in-integration.dev.avalanch.es"); Distribute.SetInstallUrl("http://install.appcenter-int.trafficmanager.net"); Distribute.SetApiUrl("https://appcenter-int.trafficmanager.net/api/v0.1"); RealUserMeasurements.SetRumKey("b1919553367d44d8b0ae72594c74e0ff"); AppCenter.Start($"uwp={UwpKey};android={AndroidKey};ios={IosKey}", typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push), typeof(RealUserMeasurements)); AppCenter.IsEnabledAsync().ContinueWith(enabled => { AppCenterLog.Info(LogTag, "AppCenter.Enabled=" + enabled.Result); }); AppCenter.GetInstallIdAsync().ContinueWith(installId => { AppCenterLog.Info(LogTag, "AppCenter.InstallId=" + installId.Result); }); AppCenterLog.Info(LogTag, "AppCenter.SdkVersion=" + AppCenter.SdkVersion); Crashes.HasCrashedInLastSessionAsync().ContinueWith(hasCrashed => { AppCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + hasCrashed.Result); }); Crashes.GetLastSessionCrashReportAsync().ContinueWith(report => { AppCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.Exception=" + report.Result?.Exception); }); }
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; }
async void UpdateRumEnabled(object sender, ToggledEventArgs e) { await RealUserMeasurements.SetEnabledAsync(e.Value); }