Created
May 17, 2017 15:06
-
-
Save julesx/3f17834c78b4dd26cb5496d5d1514f77 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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