Reputation: 1217
I was wondering how can we monitor the crashes using xamarin insights for Android.
In iOS if we just add
Insights.Report(ex, Insights.Severity.Critical);
in the main fun of the main class if does the trick.
Where should I add this code in android so I could capture all the crashes in Android?
Thanks.
Upvotes: 0
Views: 91
Reputation: 74094
FYI: Insight is deprecated
But, when we were using it, normally would set it up in main Activity
's OnCreate
, something like:
protected override void OnCreate(global::Android.OS.Bundle bundle)
{
Xamarin.Insights.Initialize(Keys.InsightsApiKey, this);
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
{
try
{
var ex = ((Exception)e.ExceptionObject).GetBaseException();
Console.WriteLine("**SPORT MAIN ACTIVITY EXCEPTION**\n\n" + ex);
Insights.Report(ex, Xamarin.Insights.Severity.Critical);
}
catch
{
}
};
~~~~~~~
}
From the Xamarin Sport Example:
Upvotes: 1