/// <summary> /// Disable vibration on suspending /// </summary> /// <param name="s"></param> /// <param name="e"></param> /// <param name="prelaunchActivated"></param> /// <returns></returns> public override Task OnSuspendingAsync(object s, SuspendingEventArgs e, bool prelaunchActivated) { GameClient.PokemonsInventory.CollectionChanged -= PokemonsInventory_CollectionChanged; GameClient.CatchablePokemons.CollectionChanged -= CatchablePokemons_CollectionChanged; NetworkInformation.NetworkStatusChanged -= NetworkInformationOnNetworkStatusChanged; if (SettingsService.Instance.IsBatterySaverEnabled) { _proximityHelper.EnableDisplayAutoOff(false); } return(base.OnSuspendingAsync(s, e, prelaunchActivated)); }
public App() { InitializeComponent(); SplashFactory = e => new Splash(e); // ensure unobserved task exceptions (unawaited async methods returning Task or Task<T>) are handled TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; // ensure general app exceptions are handled Application.Current.UnhandledException += App_UnhandledException; // Init HockeySDK if (!string.IsNullOrEmpty(ApplicationKeys.HockeyAppToken)) { HockeyClient.Current.Configure(ApplicationKeys.HockeyAppToken); } // Set this in the instance constructor to prevent the creation of an unnecessary static constructor. _displayRequest = new DisplayRequest(); // Initialize the Live Tile Updater. LiveTileUpdater = TileUpdateManager.CreateTileUpdaterForApplication(); // Init the proximity helper to turn the screen off when it's in your pocket _proximityHelper = new ProximityHelper(); _proximityHelper.EnableDisplayAutoOff(false); }