Я использую последний пакет nuget HockeyApp для xamarin, чтобы использовать Preseason. В документации для Preseason указано, что я должен поместить следующее в свой mainactivity
для нативного приложения для Android:
MetricsManager.register(this, getApplication());
Я использовал следующее в своем приложении Xamarin для Android:
MetricsManager.Register(Android.App.Application.Context, this.Application );
Однако я получаю очень странную ошибку и не знаю, как ее исправить, и правильно ли я вообще вызываю диспетчер метрик.
Вот мой код:
protected override void OnCreate(Bundle bundle)
{
try
{
base.OnCreate(bundle);
// Register the crash manager before Initializing the trace writer
HockeyApp.CrashManager.Register(this, AppId);
//Register to with the Update Manager
HockeyApp.UpdateManager.Register(this, AppId);
// Initialize the Trace Writer
HockeyApp.TraceWriter.Initialize();
// Wire up Unhandled Expcetion handler from Android
AndroidEnvironment.UnhandledExceptionRaiser += (sender, args) =>
{
// Use the trace writer to log exceptions so HockeyApp finds them
HockeyApp.TraceWriter.WriteTrace(args.Exception);
args.Handled = true;
};
MetricsManager.Register(Android.App.Application.Context, new Android.App.Application());
Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
CheckForCrashes();
CheckForUpdates();
}
catch
{
}
}
private void CheckForCrashes()
{
CrashManager.Register(this, AppId);
}
private void CheckForUpdates()
{
//todo: Remove this for production!!
UpdateManager.Register(this, AppId);
}
Вот ошибка:
в Xamarin.Forms.Platform.Android.FormsApplicationActivity.OnPrepareOptionsMenu (меню IMenu) [0x00000] в: 0 в Android.App.Activity.n_OnPrepareOptionsMenu_Landroid_view_Menu_ (IntPtr jnienv, IntPtr native__this, IntPtr native_menu) [0x00011] в /Users/builder/data /lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Activity.cs:4301 at (динамический метод оболочки) System.Object:0ea0564e-2a6f -481c-ab24-cf222ecfff78 (intptr,intptr,intptr)