/** Initializes the skylink connection */
 private void initializeSkylinkConnection() {
   if (skylinkConnection == null) {
     skylinkConnection = SkylinkConnection.getInstance();
     // The app_key and app_secret is obtained from the temasys developer console.
     skylinkConnection.init(APP_KEY, getSkylinkConfig(), this);
     // Set listeners to receive callbacks when events are triggered
     skylinkConnection.setRemotePeerListener(this);
     skylinkConnection.setDataTransferListener(this);
     skylinkConnection.setLifeCycleListener(this);
   }
 }
  @Override
  public void onDestroy() {
    // close the connection when the fragment is detached, so the streams are not open.
    if (skylinkConnection != null && connected) {
      skylinkConnection.disconnectFromRoom();
      skylinkConnection.setLifeCycleListener(null);
      skylinkConnection.setMediaListener(null);
      skylinkConnection.setRemotePeerListener(null);
      connected = false;
    }

    super.onDestroy();
  }