Skip to content

Do Not Disturb (DND) Android#

The DND API is integrated within the Seat-Pairing module of the Companion App's SDK. The pairing between the Companion App and the seat is essential for the DND functionality. This API allows passengers to set DND state through the Companion App.

The DND state API’s are accessible exclusively when the PED is operating in Air Mode. This means that the API functionality is limited to in-flight scenarios and is not available during ground operations.

Step 1: DND Object Initialisation via Seat Pairing#

To enable synchronisation of the Do Not Disturb (DND) status between the passenger’s PED (Personal Electronic Device) and the In-Flight Entertainment (IFE) seatback monitor, the application must first initialize the seat pairing service.

This pairing establishes communication between the PED and the seat, allowing DND states to remain consistent across both devices.

a. Property Declaration

private DndStateV1 mDndStateV1;
  • mDndStateV1 is declared as a property of the class.

  • This object represents the service responsible for managing DND functionality between the PED and the IFE system.

b. Seat Pairing Initialisation

To utilize the DND functionality, it is crucial to first initialise the SeatPairing module. This module is responsible for providing the DndStateV1 object, which serves as the primary interface for all DND operations. Through the DndStateV1 object, you can perform various actions, such as setting a DND state for a seat, and listening to DND state changes.

At this point, the DND service has been initialised and is available for further action.

SeatPairingV1.initService(this,
  new IInFlightCallback() {
      @Override
      public void onInitServiceComplete(Object o, String s) {
          Log.v(tag, "onInitServiceComplete() " + s);
          // Seat Pairing module initialization completed successfully
          mSeatPairingV1 = (SeatPairingV1) o;
          // Getting DndStateV1 object from the SeatPairingV1 object
          // The DndStateV1 contains the various method those are required for the DND operation
          mDndStateV1 = mSeatPairingV1.getDndState();
      }
      @Override
      public void onInitServiceFailed(String s, InFlight.Error error) {
          Log.e(tag, "onInitServiceFailed() " + InFlight.Error.getErrorMessage(error));
      }
  }, new InFlight());

In the example above, the SeatPairing module is initialised. Upon successful initialisation, it returns a SeatPairingV1 object. This object, in turn, provides access to the DndStateV1 object, which is used to perform further DND state operations.

Step 2: Get the current DND state of the seat#

Suppose a DND state was already applied to a seat before the PED was paired with it. In that case, the setDndStateEventListener method will not capture this information, as it only listens for changes after the listener is registered. In such cases, to retrieve the existing DND state after the PED has been successfully paired, you can use the getPairingStatusInfo() method provided by the SeatPairingV1 class. This method allows you to access the current pairing status along with the DND state information already set on the seat.

This getPairingStatusInfo() is called in various scenarios, such as when there is a change in the seat pairing status or when the pairing process is completed. It can be triggered through both the pairing status change listener and the pairing completion listener, ensuring that updated information is made available whenever the pairing state of the PED changes.

Example code

mSeatPairingV1.setSeatPairingStatusChangedListener(() -> {
    if (mSeatPairingV1.getPairingStatusInfo().getmPairStatus() == SeatPairingV1.PairStatus.PAIRED) {
        SeatPairingV1.PairingStatusInfo pairStatus = mSeatPairingV1.getPairingStatusInfo();
        // Here applied DND State is obtained
        boolean dndState = pairStatus.getDndState(); // returns DND State in boolean like true if it's "on" or false it's "off"
    } else {
       // PED is not paired with Seat, getDndState() returns false as default state.
    }
});

In the example above, the first step is to check if the PED is paired with the seat. If the pairing is successful, the code gets a PairingStatusInfo object that includes the seat's DND state. The PED should then display metadata based on that DND state. For example, if the seat has DND state true or false.

Step 3: Set the DND state from PED#

In addition to reading the current Do Not Disturb (DND) state, the SDK allows you to update the seat’s DND state from the PED. This ensures the passenger’s preference is reflected directly on the seatback system.

This method assigns a DND state to a specific seat from a Personal Electronic Device (PED). For the DND state to be successfully applied, the PED must first be paired with the corresponding seat. To apply a state, the setDndState method is used, which takes two parameters: the desired DND state and a OnDndStateSetListener object. Upon a successful call, the onDndStateSet callback method of the listener is invoked. If the operation fails, the onDndStateError method is triggered instead, providing appropriate error handling.

public void setDndState(boolean state, DndStateV1.OnDndStateSetListener onDndStateSetListener)

Example code

dndStateV1.setDndState(true, new DndStateV1.OnDndStateSetListener() {
    @Override
    public void onDndStateSet() {
      // set DND state API called succesfully
      // The DndStateV1.DndStateEventListener event is triggered after the DND state is successfully applied to the seat.
    }

    @Override
    public void onDndStateError(DndStateV1.Error error) {
      // Error during calling the set dnd state API
    }
});

In the example above, the DND state is set to true. Additionally, the DndStateV1.OnDndStateSetListener object is passed to the method, which enables the application to receive callbacks for various events related to the DND state process.

Step 4: Handling State Change Event#

The DND state may change from:

  • From the PED (when the passenger updates it through the app), or

  • From the seatback monitor (when the passenger updates it directly on the seat), or

  • From the Crew Terminal (when a flight attendant updates it)

To ensure the PED app always reflects the latest DND status, you must listen for system notifications broadcast by the SDK.

The DndStateV1 class offers a method named setDndStateEventListener, which accepts an instance of DndStateV1.DndStateEventListener as its parameter. This listener is responsible for handling events related to seat DND state changes. Specifically, the onDndStateChanged callback is triggered when a seat's DND state is updated, and it provides key details such as the seat number and the new DND state.

public void setDndStateEventListener(DndStateEventListener dndStateEventListener)

Example code

mDndStateV1.setDndStateEventListener(new DndStateV1.DndStateEventListener() {
    @Override
    public void onDndStateChanged(String seatNumber, boolean dndState) {
        // DND State is changed for the seat number, if dns is on then dndState is true, otherwise false
    }
});

In the example above, the system subscribes to DND state events by registering a listener. This listener includes one callback methods that is triggered when DND state change events are received from the server.

Version 1.0