Ejemplo n.º 1
0
        protected override void OnDestroy()
        {
            UnregisterReceiver(screenReceiver);
            ScreenReceiver.ScreenLocked = false;
            _orientationListener        = null;

            Game?.Dispose();
            Game = null;

            base.OnDestroy();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// OnCreate called when the activity is launched from cold or after the app
        /// has been killed due to a higher priority app needing the memory.
        /// </summary>
        /// <param name='savedInstanceState'>Saved instance state.</param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Instance = this;

            RequestWindowFeature(WindowFeatures.NoTitle);
            base.OnCreate(savedInstanceState);

            var filter = new IntentFilter();

            filter.AddAction(Intent.ActionScreenOff);
            filter.AddAction(Intent.ActionScreenOn);
            filter.AddAction(Intent.ActionUserPresent);

            screenReceiver = new ScreenReceiver();
            RegisterReceiver(screenReceiver, filter);

            _orientationListener = new OrientationListener(this);
        }