protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it var button = FindViewById <Button>(Resource.Id.MyButton); button.Click += delegate { // Crash button.Text = button.Text.Substring(42); }; // Mobile Center integration MobileCenterLog.Assert(LogTag, "MobileCenter.LogLevel=" + MobileCenter.LogLevel); MobileCenter.LogLevel = LogLevel.Verbose; MobileCenterLog.Info(LogTag, "MobileCenter.LogLevel=" + MobileCenter.LogLevel); MobileCenter.Start("44cd8722-bfe0-4748-ac14-7692e031a8a5", typeof(Analytics), typeof(Crashes)); Analytics.TrackEvent("myEvent", new Dictionary <string, string> { { "someKey", "someValue" } }); MobileCenterLog.Info(LogTag, "MobileCenter.InstallId=" + MobileCenter.InstallId); MobileCenterLog.Info(LogTag, "MobileCenter.HasCrashedInLastSession=" + Crashes.HasCrashedInLastSession); MobileCenterLog.Info(LogTag, "MobileCenter.LastSessionCrashReport=" + Crashes.LastSessionCrashReport?.AndroidDetails?.Throwable); }
protected override void OnStart() { 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; MobileCenterLog.Assert(LogTag, "MobileCenter.Configured=" + MobileCenter.Configured); MobileCenterLog.Assert(LogTag, "MobileCenter.InstallId (before configure)=" + MobileCenter.InstallId); MobileCenter.SetLogUrl("https://in-integration.dev.avalanch.es"); MobileCenter.Start("android=bff0949b-7970-439d-9745-92cdc59b10fe;ios=b889c4f2-9ac2-4e2e-ae16-dae54f2c5899", typeof(Analytics), typeof(Crashes)); Analytics.TrackEvent("myEvent"); Analytics.TrackEvent("myEvent2", new Dictionary <string, string> { { "someKey", "someValue" } }); MobileCenterLog.Info(LogTag, "MobileCenter.InstallId=" + MobileCenter.InstallId); MobileCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + Crashes.HasCrashedInLastSession); Crashes.GetLastSessionCrashReportAsync().ContinueWith(report => { MobileCenterLog.Info(LogTag, " Crashes.LastSessionCrashReport.Exception=" + report.Result?.Exception); }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it var button = FindViewById <Button>(Resource.Id.MyButton); button.Click += delegate { // Crash button.Text = button.Text.Substring(42); }; // Mobile Center integration MobileCenterLog.Assert(LogTag, "MobileCenter.LogLevel=" + MobileCenter.LogLevel); MobileCenter.LogLevel = LogLevel.Verbose; MobileCenterLog.Info(LogTag, "MobileCenter.LogLevel=" + MobileCenter.LogLevel); MobileCenter.SetLogUrl("https://in-integration.dev.avalanch.es"); MobileCenter.Start("bff0949b-7970-439d-9745-92cdc59b10fe", typeof(Analytics), typeof(Crashes)); Analytics.TrackEvent("myEvent", new Dictionary <string, string> { { "someKey", "someValue" } }); MobileCenterLog.Info(LogTag, "MobileCenter.InstallId=" + MobileCenter.InstallId); MobileCenterLog.Info(LogTag, "MobileCenter.HasCrashedInLastSession=" + Crashes.HasCrashedInLastSession); Crashes.GetLastSessionCrashReportAsync().ContinueWith(report => { MobileCenterLog.Info(LogTag, "MobileCenter.LastSessionCrashReport=" + report.Result?.AndroidDetails?.Throwable); }); }
bool OnReleaseAvailable(ReleaseDetails releaseDetails) { MobileCenterLog.Info(LogTag, "OnReleaseAvailable id=" + releaseDetails.Id + " version=" + releaseDetails.Version + " releaseNotesUrl=" + releaseDetails.ReleaseNotesUrl); var custom = releaseDetails.ReleaseNotes?.ToLowerInvariant().Contains("custom") ?? false; if (custom) { var builder = new AlertDialog.Builder(this); builder.SetTitle(string.Format(GetString(Resource.String.version_x_available), releaseDetails.ShortVersion)); builder.SetMessage(releaseDetails.ReleaseNotes); builder.SetPositiveButton(Microsoft.Azure.Mobile.Distribute.Resource.String.mobile_center_distribute_update_dialog_download, delegate { Distribute.NotifyUpdateAction(UpdateAction.Update); }); builder.SetCancelable(false); if (!releaseDetails.MandatoryUpdate) { builder.SetNegativeButton(Microsoft.Azure.Mobile.Distribute.Resource.String.mobile_center_distribute_update_dialog_postpone, delegate { Distribute.NotifyUpdateAction(UpdateAction.Postpone); }); } builder.Create().Show(); } return(custom); }
private void CheckPendingLogs() { if (!_enabled) { MobileCenterLog.Info(MobileCenterLog.LogTag, "The service has been disabled. Stop processing logs."); return; } MobileCenterLog.Debug(MobileCenterLog.LogTag, $"CheckPendingLogs({Name}) pending log count: {_pendingLogCount}"); if (_pendingLogCount >= _maxLogsPerBatch) { Task.Run(TriggerIngestionAsync); } else if (_pendingLogCount > 0 && !_batchScheduled) { _batchScheduled = true; Task.Delay((int)_batchTimeInterval.TotalMilliseconds).ContinueWith(async completedTask => { if (_batchScheduled) { await TriggerIngestionAsync().ConfigureAwait(false); } }); } }
bool OnReleaseAvailable(ReleaseDetails releaseDetails) { MobileCenterLog.Info(LogTag, "OnReleaseAvailable id=" + releaseDetails.Id + " version=" + releaseDetails.Version + " releaseNotesUrl=" + releaseDetails.ReleaseNotesUrl); var custom = releaseDetails.ReleaseNotes?.ToLowerInvariant().Contains("custom") ?? false; if (custom) { var title = "Version " + releaseDetails.ShortVersion + " available!"; Task answer; if (releaseDetails.MandatoryUpdate) { answer = Current.MainPage.DisplayAlert(title, releaseDetails.ReleaseNotes, "Update now!"); } else { answer = Current.MainPage.DisplayAlert(title, releaseDetails.ReleaseNotes, "Update now!", "Maybe tomorrow..."); } answer.ContinueWith((task) => { if (releaseDetails.MandatoryUpdate || ((Task <bool>)task).Result) { Distribute.NotifyUpdateAction(UpdateAction.Update); } else { Distribute.NotifyUpdateAction(UpdateAction.Postpone); } }); } return(custom); }
protected override void OnStart() { 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.GetErrorAttachment = ErrorAttachmentForReport; Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler; MobileCenter.Start(typeof(Analytics), typeof(Crashes)); Analytics.TrackEvent("myEvent"); Analytics.TrackEvent("myEvent2", new Dictionary <string, string> { { "someKey", "someValue" } }); MobileCenterLog.Info(LogTag, "MobileCenter.InstallId=" + MobileCenter.InstallId); MobileCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + Crashes.HasCrashedInLastSession); if (Crashes.HasCrashedInLastSession && Crashes.LastSessionCrashReport.Exception != null) { string message = Crashes.LastSessionCrashReport.Exception.Message; MobileCenterLog.Info(LogTag, "Last Session Crash Report exception message: " + message); } }
private void CheckPendingLogs(State state) { if (!_enabled) { MobileCenterLog.Info(MobileCenterLog.LogTag, "The service has been disabled. Stop processing logs."); return; } MobileCenterLog.Debug(MobileCenterLog.LogTag, $"CheckPendingLogs({Name}) pending log count: {_pendingLogCount}"); using (_mutex.GetLock()) { if (_pendingLogCount >= _maxLogsPerBatch) { _batchScheduled = true; Task.Run(async() => { await TriggerIngestionAsync(state).ConfigureAwait(false); }); } else if (_pendingLogCount > 0 && !_batchScheduled) { _batchScheduled = true; // No need wait _batchTimeInterval here. Task.Run(async() => { await Task.Delay((int)_batchTimeInterval.TotalMilliseconds).ConfigureAwait(false); if (_batchScheduled) { await TriggerIngestionAsync(_mutex.State).ConfigureAwait(false); } }); } } }
public static void Log(string tag, string message, Exception exception = null, MobileCenterLogType type = MobileCenterLogType.Warn) { switch (type) { case MobileCenterLogType.Info: MobileCenterLog.Info(tag, message, exception); break; case MobileCenterLogType.Warn: MobileCenterLog.Warn(tag, message, exception); break; case MobileCenterLogType.Error: MobileCenterLog.Error(tag, message, exception); break; case MobileCenterLogType.Assert: MobileCenterLog.Assert(tag, message, exception); break; case MobileCenterLogType.Verbose: MobileCenterLog.Verbose(tag, message, exception); break; case MobileCenterLogType.Debug: MobileCenterLog.Debug(tag, message, exception); break; default: throw new Exception("MobileCenterLogType Does Not Exist"); } }
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); }); }
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 override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { bool OnReleaseAvailable(ReleaseDetails releaseDetails) { MobileCenterLog.Info("MobileCenterDemo", "OnReleaseAvailable id=" + releaseDetails.Id + " version=" + releaseDetails.Version + " releaseNotesUrl=" + releaseDetails.ReleaseNotesUrl); var custom = releaseDetails.ReleaseNotes?.ToLowerInvariant().Contains("custom") ?? false; if (custom) { var title = "Version " + releaseDetails.ShortVersion + " available!"; UIAlertView messageBox = new UIAlertView(); messageBox.Title = title; messageBox.Message = releaseDetails.ReleaseNotes; if (releaseDetails.MandatoryUpdate) { messageBox.AddButton("Update now!"); } else { messageBox.AddButton("Update now!"); messageBox.AddButton("Maybe tomorrow..."); } messageBox.Clicked += (sender, e) => { if (releaseDetails.MandatoryUpdate || (e.ButtonIndex == 0)) { Distribute.NotifyUpdateAction(UpdateAction.Update); } else { Distribute.NotifyUpdateAction(UpdateAction.Postpone); } }; messageBox.Show(); } return(custom); } Distribute.ReleaseAvailable = OnReleaseAvailable; MobileCenter.Start("47c882b4-21ce-41dd-96fc-8e80c41c61ea", typeof(Analytics), typeof(Crashes), typeof(Push), typeof(Distribute)); Analytics.TrackEvent("OnResignActivation"); Analytics.TrackEvent("DidEnterBackground"); Analytics.TrackEvent("WillEnterForeground"); // Override point for customization after application launch. // If not required for your application you can safely delete this method // Code to start the Xamarin Test Cloud Agent #if ENABLE_TEST_CLOUD Xamarin.Calabash.Start(); #endif return(true); }
protected override void OnStart() { MobileCenter.LogLevel = LogLevel.Verbose; Crashes.ShouldProcessErrorReport = ShouldProcess; Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler; Crashes.GetErrorAttachments = GetErrorAttachments; Distribute.ReleaseAvailable = OnReleaseAvailable; MobileCenter.Start($"uwp={uwpKey};android={androidKey};ios={iosKey}", typeof(Analytics), typeof(Crashes), typeof(Distribute)); 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); }); //just a dumb way to push and pull some data from the cache MainPage.Appearing += (x, y) => { _BlobCache.GetObject <SomeObject>("test") .Catch((KeyNotFoundException ke) => Observable.Return <SomeObject>(null)) .SelectMany(someClass => { Xamarin.Forms.Device.BeginInvokeOnMainThread(() => { Current.MainPage.DisplayActionSheet($"{someClass?.ToString() ?? "null"}", null, null, $"{someClass?.ToString() ?? "null"}", $"{someClass?.ToString() ?? "null"}", $"{someClass?.ToString() ?? "null"}").ContinueWith((arg) => { }); }); return(_BlobCache.InsertObject("test", new SomeObject() { Property1 = "1234", Property2 = "4321" } )); }) .SelectMany(_ => _BlobCache.Flush()) .SelectMany(_ => _BlobCache.GetObject <SomeObject>("test")) .Subscribe(someclass => { } ); }; // Handle when your app starts }
ErrorAttachment ErrorAttachmentForReport(ErrorReport report) { MobileCenterLog.Info(LogTag, "Getting error attachment for error report"); string text = "This is an error attachment for Android"; if (report.iOSDetails != null) { text = "This is an error attachment for iOS"; } return(ErrorAttachment.AttachmentWithText(text)); }
protected override void OnStart() { MobileCenterLog.Assert(LogTag, "MobileCenter.LogLevel=" + MobileCenter.LogLevel); MobileCenter.LogLevel = LogLevel.Verbose; MobileCenterLog.Info(LogTag, "MobileCenter.LogLevel=" + MobileCenter.LogLevel); MobileCenter.Start(typeof(Analytics), typeof(Crashes)); Analytics.TrackEvent("myEvent"); Analytics.TrackEvent("myEvent2", new Dictionary <string, string> { { "someKey", "someValue" } }); MobileCenterLog.Info(LogTag, "MobileCenter.InstallId=" + MobileCenter.InstallId); MobileCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + Crashes.HasCrashedInLastSession); }
static void SendingErrorReportHandler(object sender, SendingErrorReportEventArgs e) { MobileCenterLog.Info(LogTag, "Sending error report"); var report = e.Report; //test some values if (report.Exception != null) { MobileCenterLog.Info(LogTag, report.Exception.ToString()); } else if (report.AndroidDetails != null) { MobileCenterLog.Info(LogTag, report.AndroidDetails.ThreadName); } }
protected override void OnStart() { 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); MobileCenterLog.Assert(LogTag, "MobileCenter.InstallId (before configure)=" + MobileCenter.InstallId); 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"); // 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.Start($"uwp={uwpKey};android={androidKey};ios={iosKey}", typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push)); MobileCenterLog.Info(LogTag, "MobileCenter.InstallId=" + MobileCenter.InstallId); MobileCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + Crashes.HasCrashedInLastSession); Crashes.GetLastSessionCrashReportAsync().ContinueWith(report => { MobileCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.Exception=" + report.Result?.Exception); }); }
static void FailedToSendErrorReportHandler(object sender, FailedToSendErrorReportEventArgs e) { MobileCenterLog.Info(LogTag, "Failed to send error report"); var report = e.Report; //test some values if (report.Exception != null) { MobileCenterLog.Info(LogTag, report.Exception.ToString()); } else if (report.AndroidDetails != null) { MobileCenterLog.Info(LogTag, report.AndroidDetails.ThreadName); } if (e.Exception != null) { MobileCenterLog.Info(LogTag, "There is an exception associated with the failure"); } }
void SentErrorReportHandler(object sender, SentErrorReportEventArgs e) { MobileCenterLog.Info(LogTag, "Sent error report"); var args = e as SentErrorReportEventArgs; ErrorReport report = args.Report; //test some values if (report.Exception != null) { MobileCenterLog.Info(LogTag, report.Exception.ToString()); } else { MobileCenterLog.Info(LogTag, "No system exception was found"); } if (report.AndroidDetails != null) { MobileCenterLog.Info(LogTag, report.AndroidDetails.ThreadName); } }
public static void Log(Exception exception, MobileCenterLogType type = MobileCenterLogType.Warn) { var exceptionType = exception.GetType().ToString(); var message = exception.Message; System.Diagnostics.Debug.WriteLine(exceptionType); System.Diagnostics.Debug.WriteLine($"Error: {message}"); switch (type) { case MobileCenterLogType.Info: MobileCenterLog.Info(exceptionType, message, exception); break; case MobileCenterLogType.Warn: MobileCenterLog.Warn(exceptionType, message, exception); break; case MobileCenterLogType.Error: MobileCenterLog.Error(exceptionType, message, exception); break; case MobileCenterLogType.Assert: MobileCenterLog.Assert(exceptionType, message, exception); break; case MobileCenterLogType.Verbose: MobileCenterLog.Verbose(exceptionType, message, exception); break; case MobileCenterLogType.Debug: MobileCenterLog.Debug(exceptionType, message, exception); break; default: throw new Exception("MobileCenterLogType Does Not Exist"); } }
protected override void OnStart() { MobileCenter.LogLevel = LogLevel.Verbose; Crashes.ShouldProcessErrorReport = ShouldProcess; Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler; Crashes.GetErrorAttachments = GetErrorAttachments; Distribute.ReleaseAvailable = OnReleaseAvailable; MobileCenter.Start($"uwp={uwpKey};android={androidKey};ios={iosKey}", typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push)); 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); }); }
static PlatformCrashes() { MobileCenterLog.Info(Crashes.LogTag, "Set up Xamarin crash handler."); AndroidEnvironment.UnhandledExceptionRaiser += OnUnhandledException; AndroidCrashes.Instance.SetWrapperSdkListener(new CrashListener()); }
public void Track(string trackIdentifier) { Analytics.TrackEvent(trackIdentifier); MobileCenterLog.Info(MobileCenterLog.LogTag, trackIdentifier); }
static PlatformCrashes() { MobileCenterLog.Info(Crashes.LogTag, "Set up Xamarin crash handler."); AndroidEnvironment.UnhandledExceptionRaiser += OnUnhandledException; }
bool ShouldProcess(ErrorReport report) { MobileCenterLog.Info(LogTag, "Determining whether to process error report"); return(true); }