Code example for WifiManager.WifiLock

Methods: isHeld, release

0
  public void onPause() { 
    super.onPause(); 
 
    videoView.pause();
 
    if (wifiLock != null && wifiLock.isHeld()) {
      wifiLock.release();
    } 
  } 
 
  @Override 
  public boolean onError(final MediaPlayer mp, final int what, final int extra) {
    Log.e(TAG, "Media player error " + what + "/" + extra);
    switch (what) {
    case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
      openVideo(); 
      return true; 
    default: 
      new ErrorDialogFragment().show(getFragmentManager(), "error"); 
      return true;