Skip to content

Instantly share code, notes, and snippets.

@julesx
Created May 17, 2017 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julesx/3f17834c78b4dd26cb5496d5d1514f77 to your computer and use it in GitHub Desktop.
Save julesx/3f17834c78b4dd26cb5496d5d1514f77 to your computer and use it in GitHub Desktop.
using Android.App;
using Android.Content.PM;
using Android.OS;
using HockeyApp.Android;
using FFImageLoading.Forms.Droid;
using HockeyApp.Android.Utils;
using Plugin.Media;
using Plugin.Permissions;
namespace Merrit.Droid
{
[Activity(Label = "Merrit", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
InitLibraries();
InitHockeyApp();
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
{
PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
private void InitHockeyApp()
{
HockeyLog.LogLevel = 4;
CrashManager.Register(this, "myAppId");
UpdateManager.Register(this, "myAppId");
}
private void InitLibraries()
{
var x = typeof(Xamarin.Forms.Themes.LightThemeResources);
x = typeof(Xamarin.Forms.Themes.Android.UnderlineEffect);
CachedImageRenderer.Init();
CrossMedia.Current.Initialize();
}
private void UnregisterManagers()
{
UpdateManager.Unregister();
}
protected override void OnPause()
{
base.OnPause();
UnregisterManagers();
}
protected override void OnDestroy()
{
base.OnDestroy();
UnregisterManagers();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment