Skip to content

Android Seat Pairing (PED)#

Initialize Pairing Service#

First, initialize the Pairing service in the Companion App on the PED, then set the pairing listener. The seat pairing process occurs between the Companion App on the PED and both the Pairing application and 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 Companion application initializes pairing with SeatPairingV1.initService(). The Companion App on the PED receives the Pairing object.Below code sets up a callback mechanism for handling the success or failure of the SeatPairingV1 service initialization. If initialization succeeds, it provides access to the initialized service object through mSeatPairingV1, allowing further actions to be taken. If initialization fails, appropriate error handling can be performed inside the onInitServiceFailed method.

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

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

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

  • Observing Pair Status Change: The Companion App on the PED should register to mSeatPairingV1.setSeatPairStatusChangeListener() to listen for pairing updates and mSeatPairingV1.setSeatPairingInitiatePairRejectedListener() to listen for notifications when a user rejects a pairing request on a seatback monitor

SeatPairingV1 Initialization#

SeatPairingV1.initService(this,
        new IInFlightCallback() {
            @Override
            public void onInitServiceComplete(Object o, String s) {
                // If the initialization succeeds, cast the returned object into SeatPairingV1
                mSeatPairingV1 = (SeatPairingV1) o;
                if (mSeatPairingV1 != null) { // Check if mSeatPairingV1 is not null before proceeding with pairing-related operations
                    // Retrieve the current seat pairing status and set listeners for seat remote controller info, media queue changes, and playback state changes
                }
            }

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

RegisterListener for Seat Pairing Updates#

mSeatPairingV1.setSeatPairingStatusChangedListener(new SeatPairingV1.SeatPairingStatusChangedListener() {
    @Override
    public void onSeatPairingStatusChange() {
        SeatPairingV1.PairStatus status = mSeatPairingV1.getPairStatus();
    }
});
mSeatPairingV1.setSeatPairingInitiatePairRejectedListener(new SeatPairingV1.SeatPairingInitiatePairRejectedListener() {
    @Override
    public void onSeatPairingInitiatePairRejected(String s) {

    }
});

Pairing Process#

Seat Pairing Framework is responsible for starting a pairing session between a passenger’s personal electronic device (PED) and the interactive seatback monitor. There are three pairing modes available: Passcode and QR Code Scanning. In Passcode mode, passengers can manually input a passcode on the seatback monitor/PED. QR Code Scanning utilizes deep linking

1. PED Initiates Pairing :#

When initiating pairing from the PED (Portable Electronic Device), a request called initiatePairingWithSeatNumber is made using an API call. This API call requires passing the seat number, which will prompt the Interactive system associated with that seat to 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. Parameters :

  • seatNumber: The seat number to which the pairing needs to be initiated.

  • deviceName: The name of the device initiating the pairing.

  • messageToDisplay: A message to display during the pairing process.

  • It takes an instance of SeatInitiatePairingCompleteListener as a parameter.

onSeatPairingError : This callback method is triggered when there's an error during the seat pairing process.The error parameter provides details about the encountered error, allowing for appropriate error handling.If the error is related to the seat already being in use or the seat number being invalid, appropriate actions can be taken, such as displaying an error message or handling the error scenario.

onSeatInitiatePairingComplete : This callback method is triggered when the seat pairing process completes successfully. Retrieves pairing status information using mSeatPairingV1.getPairingStatusInfo(), then obtains various details such as pairing status, seat number, seat class, and cabin zone index from the PairingStatusInfo object.

PED Initiated Pairing#

mSeatPairingV1.initiatePairingWithSeatNumber(seatNumber, deviceName, messageToDisplay, new SeatPairingV1.SeatInitiatePairingCompleteListener() {
    @Override
    public void onSeatPairingError(SeatPairingV1.Error error) {
        if (error == SeatPairingV1.Error.SEAT_INITIATE_PAIRING_ERROR_SEAT_IN_USE) {
            //Seatback with seatnumber provided is already paired with another device.
        }
        else if(error == SeatPairingV1.Error.SEAT_INITIATE_PAIRING_ERROR_SEAT_NOT_FOUND){
            //Invalid Seat Number
        }
    }

    @Override
    public void onSeatInitiatePairingComplete() {
        SeatPairingV1.PairingStatusInfo pairStatus = mSeatPairingV1.getPairingStatusInfo();
        pairStatus.getmPairStatus();
        pairStatus.getmSeatNumber();
        pairStatus.getSeatClass();
        pairStatus.getmCabinZoneIndex();
        pairStatus.getSeatRating();
        pairStatus.getDndState();
        pairStatus.accessibilitySetting();
        pairStatus.getSeatMidBlocked();
    }

    @Override
    public void onSeatInitiatePairingComplete(List<SeatPairingV1.PairingMode> list) {

    }
});

The provided code snippet is a method call to initiate pairing with a seat number using the initialized service object mSeatPairingV1 object

2. Interactive Initiated Pairing :#

When initiating pairing from the Interactive (pair button is clicked in the interactive ), 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.

pairwithPassCode#

Parameters :

  • passcode: passcode used for pairing

  • deviceName: The name of the device initiating the pairing.

  • messageToDisplay: A message to display during the pairing process.

  • It takes an instance of SeatInitiatePairingCompleteListener as a parameter.

onSeatPairingError : This callback method is triggered when there's an error during the seat pairing process.The error parameter provides details about the encountered error, allowing for appropriate error handling.

onSeatInitiatePairingComplete : This callback method is triggered when the seat pairing process completes successfully. Retrieves pairing status information using mSeatPairingV1.getPairingStatusInfo(), then obtains various details such as pairing status, seat number, seat class, and cabin zone index from the PairingStatusInfo object.

 mSeatPairingV1.pairWithPasscode(passCode,seatNumber,deviceName,messageToDisplay, new SeatPairingV1.SeatPairingCompleteListener() {
     @Override
     public void onSeatPairingComplete() {
        SeatPairingV1.PairingStatusInfo pairStatus = mSeatPairingV1.getPairingStatusInfo();
     }

     @Override
     public void onSeatPairingError(SeatPairingV1.Error error) {
     }
 });

The provided code snippet is a method call to initiate pairing with a passcode displayed on interactive using the initialized service object mSeatPairingV1 object

3. Pair with QRCode :#

QR Code Scanning utilizes deep linking, as illustrated in the example below. Deep linking is a concept where you can open a specific content or view within a mobile app directly, often in response to a URL or user action. This can be useful for various scenarios, such as opening a specific product page, navigating to a particular section of the app, or handling dynamic content.Deep linking in Android allows you to link directly to specific content within an app, rather than just opening the app's main screen. This is achieved by defining intent filters in your app's manifest file, which specify the URLs or URIs that your app can handle. To implement deep linking using the data tag in an activity, you need to follow these steps:

  • Declare Intent Filters: In your activity's declaration in the AndroidManifest.xml file, define intent filters that specify the data scheme, host and path your activity can handle.

setup for handling deep linking#

<!-- AndroidManifest.xml -->
<activity android:name=".YourActivity">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="https" android:host="example.com". android:pathPrefix="/path"  />
    </intent-filter>
</activity>

In this example:

  • android:scheme: Specifies the URI scheme (e.g. pac , http, https, custom_scheme).

  • android:host: Specifies the host part of the URI.

  • android:pathPrefix: Specifies the path or path prefix part of the URI.

  • Handle the Deep Link Intent: In your activity, handle the intent that launches the activity from the deep link.When a URL matching the specified scheme, host is opened on the device, Android will look for apps that have declared intent filters matching URL pattern. If your app is installed and matches the URL pattern, Android will launch your activity.Depending on your requirements, you may need to handle more complex scenarios, such as parsing query parameters or handling different types of deep links.

if (Intent.ACTION_VIEW == intent.getAction()) {
    Uri uri = intent.getData();
    // If uri matches the host declared in manifest for activity
    if (uri.getHost().matches("example.com") == true) {
        String test = uri.getQuery();
        // Use the above extracted passcode to do seat pairing using – pairWithPasscode()
    }
}

3. Test the DeepLinking:#

In this flow:

  • Start by scanning the QR code using the camera app.

  • Once the QR code is detected, it opens the URL encoded within the QR code in Browser.

  • Browser triggers the Companion App using its URL scheme.

  • This action triggers the Activity of the Companion App.

  • The Activity extracts the passcode from the URL.

  • Then, the extracted passcode is used to call the pairWithPasscode method for pairing.

  • Finally, the pairing process is completed

Unpairing Process:#

Unpairing from the PED#

The passenger can unpair the PED from the seatback monitor by selecting Unpair Device on the PED These flowcharts outline the process of unpairing from PED. The unpairing process is initiated by clicking on the "Unpair" option. Then, the unpairFromSeat API is called, and once the unpairing is completed, the process ends.

upairFromSeat#

The provided code snippet demonstrates the usage of the unpairFromSeat method . This method is responsible for initiating the unpairing process of a seat. It takes an instance of SeatUnPairingCompleteListener interface as a parameter.

  • onSeatUnpairError: This method is invoked if an error occurs during the unpairing process. The error parameter provides details about the encountered error, allowing for appropriate error handling.

  • onSeatUnPairingComplete: This method is called upon successful completion of the seat unpairing process. It signifies that the seat has been successfully unpaired, enabling subsequent actions to be performed.

 mSeatPairingV1.unpairFromSeat(new SeatPairingV1.SeatUnPairingCompleteListener() {
     @Override
     public void onSeatUnpairError(SeatPairingV1.Error error) {

     }

     @Override
     public void onSeatUnPairingComplete() {

     }
});

Unpairing from the Seatback Monitor#

The passenger can unpair the PED from the seatback monitor by selecting Unpair Device on the Interactive In the flowchart, unpairing is initiated from interactive and PED receives notification, which indicates a change in pair status to "Unpair".

SeatPairingStatusChangeListener#

The provided code snippet demonstrates to sets a listener for changes in the seat pairing status .This indicates that whenever there's a change in the seat pairing status, the method onSeatPairingStatusChange() will be invoked. getPairStatus() is a method that retrieves the current pairing status of the seat pairing.

mSeatPairingV1.setSeatPairingStatusChangedListener(new SeatPairingV1.SeatPairingStatusChangedListener() {
    @Override
    public void onSeatPairingStatusChange() {
        SeatPairingV1.PairStatus status = mSeatPairingV1.getPairStatus();
    }
});

Get Blocked MID List After Pairing#

The following code snippet demonstrates how to retrieve the list of blocked MIDs, if any. When the PED is successfully paired with a seat, the system returns the current list of blocked MIDs. The getSeatMidBlocked() method is used to fetch the blocked MID list from the current seat pairing status.

mSeatPairingV1.setSeatPairingStatusChangedListener(() -> {
    List<String> midBlockedlist = mSeatPairingV1.getPairingStatusInfo().getSeatMidBlocked();
});

SeatMidBlockEventListener#

The following code snippet demonstrates how to register a listener to receive updates whenever the blocked MID list changes. Whenever any MID is blocked or unblocked, the onSeatPairingBlockedMIDsChangeNotification() callback is triggered with the updated list of blocked MIDs.

mSeatPairingV1.setSeatMidBlockEventListener(new SeatPairingV1.SeatMidBlockEventListener() {
      @Override
      public void onSeatPairingBlockedMIDsChangeNotification(List<String> blockedMIDs) {
          // blockedMIDs returns list of Block MID
      }
});

Version 1.2