public void OnStop() { if (Stopped != null) { Stopped(Activity); } AccelerometerListener.StopListening(); }
public void OnStart() { if (Started != null) { Started(Activity); } AccelerometerListener.StartListening(Input); }
public void OnDestroy() { if (Destroying != null) { Destroying(Activity); } AccelerometerListener.StopListening(); Activity = null; }
public static void StopListening() { if (listener != null) { var activity = Lime.ActivityDelegate.Instance.Activity; var sensorManager = (SensorManager)activity.GetSystemService(Android.Content.Context.SensorService); sensorManager.UnregisterListener(listener); listener = null; } }
public void OnDestroy() { if (Destroying != null) { Destroying(Activity); } AccelerometerListener.StopListening(); Application.SupportedDeviceOrientationsChanged -= RestrictSupportedOrientationsWith; Activity = null; }
public void OnPause() { AudioSystem.Active = false; GameView.ClearFocus(); if (Paused != null) { Paused(Activity); } AccelerometerListener.StopListening(); }
public static void StartListening(Input input) { if (listener == null) { listener = new AccelerometerListener() { input = input }; var activity = Lime.ActivityDelegate.Instance.Activity; var sensorManager = (SensorManager)activity.GetSystemService(Android.Content.Context.SensorService); sensorManager.RegisterListener(listener, sensorManager.GetDefaultSensor(SensorType.Accelerometer), SensorDelay.Ui); } }
public void OnResume() { AudioSystem.Active = true; if (!GameView.IsFocused) { GameView.RequestFocus(); } AccelerometerListener.StartListening(Input); if (Resumed != null) { Resumed(Activity); } }