Yes, you can able to handle error globally, by adding some line code in ApplicationStart class, something like below:
[Application(Label = "@string/app_name", Icon = "@drawable/ic_launcher")]
public class ApplicationStart : Application
{
public ApplicationStart(IntPtr handle,
global::Android.Runtime.JniHandleOwnership transfer)
: base(handle, transfer)
{
}
public override void OnCreate()
{
AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledExceptionRaiser;
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += CurrentDomainOnUnhandledException;
base.OnCreate();
}
private void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
//you can able to write a code here to write Exeption e to file
Toast.MakeText(ApplicationContext, "Application crashed", ToastLength.Short).Show();
}
private void AndroidEnvironmentOnUnhandledExceptionRaiser(object sender, RaiseThrowableEventArgs e)
{
//if you have set e.Handled = true here then when application crashed at any point at that time device not stoped your app to go more
e.Handled = true;
//you can able to write a code here to write Exeption e to file
Toast.MakeText(ApplicationContext, "Application crashed", ToastLength.Short).Show();
}
}