private void _Stop() { try { _StopProcess(); if (m_WakeLock != null && m_WakeLock.IsHeld) { m_WakeLock.Release(); } if (m_WifiLock != null && m_WifiLock.IsHeld) { m_WifiLock.Release(); } Android.OS.Process.SetThreadPriority(ThreadPriority.Default); m_Running = false; } catch (Exception e) { e.PrintStackTrace(); } if (m_SnapclientListener != null) { m_SnapclientListener.OnPlayStateChanged(this); } }
/// <summary> /// This will release the wifi lock if it is no longer needed /// </summary> public void ReleaseWifiLock() { if (wifiLock.IsHeld) { wifiLock.Release(); } }
public bool ReleaseLock(string lock_type = "screenDim") { lock (wakeLocks) { if (!wakeLocks.ContainsKey(lock_type)) { return(false); } switch (lock_type) { case "screenDim": case "partial": case "proximityScreenOff": PowerManager.WakeLock pm_lock = (PowerManager.WakeLock)wakeLocks[lock_type]; pm_lock.Release(); break; case "wifi": WifiManager.WifiLock wm_lock = (WifiManager.WifiLock)wakeLocks[lock_type]; wm_lock.Release(); break; } wakeLocks.Remove(lock_type); return(true); } }
public void PausePlayer() { try { _player.Pause(); MediaPlayerState = MediaPlayerState.Paused; } catch { MediaPlayerState = MediaPlayerState.None; } if (_wifiLock.IsHeld) { _wifiLock.Release(); } }
/// <summary> /// This will release the wifi lock if it is no longer needed /// </summary> private void ReleaseWifiLock() { if (_wifiLock == null) { return; } _wifiLock.Release(); _wifiLock = null; }
/// <summary> /// This will release the wifi lock if it is no longer needed /// </summary> private void ReleaseWifiLock() { if (wifiLock == null || !wifiLock.IsHeld) { return; } wifiLock.Release(); wifiLock = null; }
public void Release() { if (_wifiLock != null) { _wifiLock.Release(); _wifiLock = null; } if (_powerWakeLock != null) { _powerWakeLock.Release(); _powerWakeLock = null; } }
/// <summary> /// This will release the wifi lock if it is no longer needed /// </summary> public void ReleaseWifiLock() { try { if (wifiLock == null || !wifiLock.IsHeld) { return; } wifiLock.Release(); } catch (Java.Lang.RuntimeException ex) { Console.WriteLine(ex.Message); } wifiLock = null; }
private void CleanUp(bool releaseMediaPlayer) { Logger.Debug("CleanUp"); _musicService.StopForeground(true); if (releaseMediaPlayer && _mediaPlayer != null) { _mediaPlayer.Reset(); _mediaPlayer.Release(); _mediaPlayer = null; } if (_wifiLock.IsHeld) { _wifiLock.Release(); } }
void StopHelper() { currentState = MediaStates.End; if (player != null) { player.Stop(); player.Release(); player.Dispose(); } wifiLock.Release(); wifiLock.Dispose(); am.UnregisterMediaButtonEventReceiver(mediaComponent); am.Dispose(); mediaComponent.Dispose(); StopForeground(true); }
void RelaxResources(bool releaseMediaPlayer) { LogHelper.Debug(Tag, "relaxResources. releaseMediaPlayer=", releaseMediaPlayer); if (releaseMediaPlayer && mediaPlayer != null) { if (canUseVisualizer) { visualizer.SetEnabled(false); visualizer.Release(); } mediaPlayer.Reset(); mediaPlayer.Release(); mediaPlayer = null; } if (wifiLock.IsHeld) { wifiLock.Release(); } }
/// <summary> /// This will release the wifi lock if it is no longer needed /// </summary> private void ReleaseWifiLock() { wifiLock?.Release(); wifiLock = null; }