Skip to content

Android Seat Pairing (SeatBack)#

The Pairing Framework in the Seatback App SDK allows passengers to start and stop pairing with the In-Flight Entertainment (IFE) seatback monitor and headset. Once paired successfully, passengers can use features like launching media, controlling the media, adjusting seat preferences, and exchanging messages through the paired PED.

The Pairing Framework enables the connection between the Interactive application on the seatback monitor and the Companion App on the passenger's electronic device (PED). This connection allows the Interactive application to receive commands from the paired PED, such as launching media and managing the queue. Additionally, information from the media player—like elapsed time, total duration, soundtrack, and subtitle language options—is shared between the Interactive application and the Companion App.

Initialize Pairing Service#

First, initialize the Pairing service in the Interactive App on the Seat, then set the pairing listener. The pairing process occurs between the Companion App on the PED and the Interactive application on the seatback monitor. The Interactive application must listen for updates from the Pairing application and respond accordingly.

Pairing Initialization: To begin, initialize the Pairing service object to return the object with InFlightCallback. The interactive application initializes pairing with Pairing.initService(). The interactive App on the seat receives the Pairing object. The code below sets up a callback mechanism for handling the success or failure of the Pairing service initialization. If initialization succeeds, it provides access to the initialized service object through Pairing, allowing further actions to be taken. If initialization fails, appropriate error handling can be performed using the onInitServiceFailed method.

  1. Initialization: The method initService is called to initialize the pairing service.

  2. Success Case: If initialization is successful, it provides access to the initialized service object inside the onInitServiceComplete method

  3. Failure Case: If initialization fails, appropriate error handling can be performed using the onInitServiceFailed method.

```java Pairing.initService(context,new IInFlightCallback() { @Override public void onInitServiceComplete(Object o, String s) { // If the initialization succeeds, cast the returned object into SeatPairingV1 mPairing = (Pairing) o; if (mPairing != null) { // Perform operation like observing pairing status, which mentioned in the below code snippet } }

 @Override
 public void onInitServiceFailed(String s, InFlight.Error error) {
     // Handle initialization failure
 }

}, new InFlight()); ```

When to initialize pairing?#

The pairing functionality depends on the seatback app (seat-service), which is a separate application running on the seatback monitor. This app may not be available immediately after a factory reset. In other words, if the seatback app is installed after the Interactive app, the pairing initialization may fail or result in a SecurityException.

To address this issue, the Interactive app should catch the exception and implement a periodic retry mechanism for binding. When the service installation completes, Android sends an android.intent.action.PACKAGE_ADDED broadcast with the service’s package name. The Interactive app can listen for this broadcast and attempt binding once the service becomes available. In this case, the Interactive app should attempt to initialize the pairing service only after aero.panasonic.inflight.app.seatback becomes available.

Observing Pairing Status Change: The interactive App on the seat should register to mPairing.setSeatPairStatusChangeListener()to listen for pairing updates and mPairing.setSeatPairingErrorListener() to listen for notifications when the pairing request from the PED app.

mPairing.setSeatPairingStatusChangedListener(new Pairing.SeatPairingStatusChangedListener() {
    @Override
    public void onSeatPairingStatusChange(final Pairing.PairStatus pairStatus) {
        Pairing.PairStatus status = pairStatus;
    }
});
mPairing.setSeatPairingErrorListener(new Pairing.SeatPairingErrorListener() {
    @Override
    public void onSeatPairingError(Pairing.Error error) {

    }
});

Pairing Process#

The Pairing Framework is responsible for initiating a pairing session between the interactive app and a passenger's electronic device (PED).

1. Sets Pairing Method Configuration and initiates Pairing :

Set Pairing Method :

Before initiating pairing from the seat, the pairing method must be set using the setPairedMethod() API. This API call requires passing true for QR, prompting the Interactive system linked to that seat to display a passcode. The passcode can then be used by the PED to make a subsequent API call, pairWithPasscode, where the passcode is submitted to start the pairing process.

SeatBack

private final String SHOW_QR_CODE = "show_qr_code";
private final String SHOW_PASSCODE = "show_passcode";
private boolean qrCode;
private boolean passCode;
JSONObject pairing_screen_methods = new JSONObject();
try {
    pairing_screen_methods.put(SHOW_QR_CODE,qrCode);
    pairing_screen_methods.put(SHOW_PASSCODE,passCode);
} catch (JSONException e) {
    e.printStackTrace();
}
mPairing.setPairingMethod(pairing_screen_methods);

The provided code snippet is a method call to set the pairing method either QR or Passcode or both.

Parameters:

  • pairingMethods: JsonObject to Set the pairing method QR either Passcode.

Initiates Pairing:

When initiating pairing from the Interactive (the pair button is clicked in the interactive ), the Interactive will display a passcode. This passcode can then be utilized by the PED to make a further API call named "pairWithPasscode", where the passcode is submitted to initiate the pairing process.

 mPairing.initiatePairing();

The provided code snippet is a method call to initiate pairing to display QR or Passcode on Interactive.

2. Unpairing:

The passenger can unpair the Interactive from the PED using unpair() API.

mPairing.unpair();

The provided code snippet demonstrates the use of the unpair method, which initiates the unpairing process of a seat.

Types of Pairing Popup#

The type of pairing popup to be displayed is determined by the configuration set in the database. Depending on the value stored in the database, the corresponding popup or event for the popup is triggered and handled within the interactive system

1. Default popup

It's a Panasonic popup, featuring a pairing code and a QR code, and comes with restricted UI modification options. This eliminates the need for interactive developers to design the popup from scratch. No Additional effort is required for these pairing popup, apart from Step 1.

2. Embedded Popup

This popup is an integral part of an interactive. As interactive developers, they have the flexibility to design the popup according to their specific requirements and preferences. The Software Development Kit (SDK) supports this customization by providing a variety of events and functionalities essential for implementing and managing the embedded popup effectively. The following code snippet shows how to register for various events related to the embedded pairing popup.

Pairing.PairingGuiDisplayListener embeddedPopCallbacks = new Pairing.PairingGuiDisplayListener() {
    @Override
    public void showConfirmScreen(String s, String s1, String s2) {
        // This event is triggered after the pairing code is entered to display a confirmation popup.
        // The confirmation popup is optional and it is determined by a value configured in the database.
    }

    @Override
    public void showPasscodeScreen(String s,String s1) {
        // This event is triggered when pairing is initiated, either from the seat system or the Personal Electronic Device (PED).
        // During this event, an embedded popup must be displayed to the passenger.
        // The popup serves as the interface where the pairing information, such as a QR code or a passcode, is presented.
    }

    @Override
    public void showPairCompleteScreen() {
        // This event is triggered to show pairing confimration to the passenger
    }

    @Override
    public void showUnpairCompleteScreen() {
        // This event is triggered to show un-pairing successfully
    }
};

mParing.setPairingGuiDisplayListener(embeddedPopCallbacks);
mPairing.initiatePairing();

Version 1.1