Skip to content

Crew Messaging Android#

Crew messaging is a component of the Seat Pairing module. To utilise its various messaging features, it is necessary to first initialise the seat‑pairing module. To use the crew messaging service, the passenger’s personal device must first be paired with the seat.

1 : Initialisation of crew message service via seat pairing#

The CrewMessagingV1 class is used to carry out a range of operations related to crew messaging. It provides a set of methods for handling various functionalities, such as sending messages, retrieving historical messages, and checking message limits. An instance of CrewMessagingV1 can be obtained through an existing SeatPairingV1 object, allowing seamless access to all of these messaging features. For more information about the initialisation process of the seat‑pairing functionality, please refer to the SeatPairing documentation.

CrewMessagingV1 mCrewMessaging = mSeatPairingV1.getCrewMessaging();

2: Retrieve Crew Messaging Limits#

Before allowing a passenger to send messages to the crew, it’s important to first review the messaging limits set by the airline. This check ensures that the passenger stays within the allowed number of messages and character limits. In addition, it provides information about the warning threshold for remaining messages and the total number of messages already sent during the flight. To obtain all of this information by calling the getMessageLimits method using the CrewMessagingV1 instance.

public void getMessageLimits(CrewMessagingListener listener)

Parameter :

  • CrewMessagingListener - The CrewMessagingListener delivers results from the crew messaging service through two callback methods: onDataReceived and onError.

  • The onDataReceived method is called when data is successfully received. The data is returned as a JSON object.

  • The onError method is invoked if there is an issue while retrieving the data. It provides an error code from the CrewMessagingV1.Error enumeration, which can be used to identify the type of error and handle it appropriately.

The JSON object returned by the onDataReceived method is shown below:

{
  "data":{
    "max_message_size":160, //(characters size limit)
    "max_messages_limit":15, // Per flight
    "remaining_message_warning_threshold":5,
    "messages_sent":0  // Per flight
  }
}
  • max_message_limit : This represents the maximum number of messages a passenger is allowed to send. Every airline can configure this limit based on its policies. You should prevent further message sending once this limit is reached.

  • messages_sent : Indicates the number of messages the passenger has already sent.

  • remaining_message_warning_threshold : If the number of remaining messages falls below this threshold, you may choose to display a warning to the user to provide a better user experience and proactive guidance.

  • max_message_size: This value defines the maximum number of characters allowed per message. Developers should enforce this limit on the message input field by disabling input beyond this character count. For example, if the limit is 160, prevent the user from typing more than 160 characters.

e.g.

 mCrewMessaging.getMessageLimits(new CrewMessagingV1.CrewMessagingListener() {
                    @Override
                    public void onDataReceived(JSONObject response) {
                        //Method invoked after successful retrival data
                    }

                    @Override
                    public void onError(CrewMessagingV1.Error error) {
                        //Method invoked if any error occur during fetching the data
                    }
                });

3: Fetch the Message History#

To improve the user experience, it is advisable to show the history of messages previously sent to the crew before allowing the passenger to send a new one. However, this feature is entirely optional and can be implemented based on the developer’s preferred user interface design for the application.

To obtain the historic messages getMessageHistory method using the CrewMessagingV1 instance.

public void getMessageHistory(CrewMessagingListener listener)

Parameter:

  • CrewMessagingListener - The CrewMessagingListener delivers results from the crew messaging service through two callback methods: onDataReceived and onError.

  • The onDataReceived method is called when data is successfully received. The data is returned as a JSON object.

  • The onError method is invoked if there is an issue while retrieving the data. It provides an error code from the CrewMessagingV1.Error enumeration, which can be used to identify the type of error and handle it appropriately.

The JSON object returned by the onDataReceived method is shown below:

{
  "data":[
    {
      "message":"Can I get glass of water?",
      "timestamp":"2021-12-06T11:20:19+0000"
    },
    {
      "message":"Can I get blanket?",
      "timestamp":"2021-12-06T11:20:19+0000"
    }
  ]
}

e.g.

mCrewMessaging.getMessageHistory(new CrewMessagingV1.CrewMessagingListener() {
  @Override
  public void onDataReceived(JSONObject response) {
    //The JSON object returned after a successful API call.
  }

  @Override
  public void onError(CrewMessagingV1.Error error) {
    //Method get invoked if any error occured during API call
  }
});

4: Send Message to the crew#

Sends a text message from the PED to the CT/CMI (Crew Terminal/Crew Member Interface) if the device is successfully paired with a seatback monitor. By default, each message can contain a maximum of 160 characters, and a total of 15 messages can be sent per flight. These limits may be overridden or adjusted by the airline’s configuration. If the PED is not paired with any seat, the message will not be transmitted.

Before sending a message, make sure to:

  • Check the current message limits by calling the getMessageLimits API. This allows you to confirm that the passenger is still eligible to send messages and has not exceeded the allowed limit. Use the max_messages_limit and messages_sent values to perform this validation.

  • Enforce the character limit in the message input field. Use the max_message_size value returned by the getMessageLimits response to restrict the number of characters that can be entered.

public void sendMessage(String message, CrewMessagingListener listener)

Parameter

  • message : The message is a UTF‑8 encoded string

  • CrewMessagingListener - The CrewMessagingListener delivers results from the crew messaging service through two callback methods: onDataReceived and onError.

  • The onDataReceived method is called when data is successfully received. The data is returned as a JSON object. The method returns the following JSON object after successfully sending the message

  • The onError method is invoked if there is an issue while retrieving the data. It provides an error code from the CrewMessagingV1.Error enumeration, which can be used to identify the type of error and handle it appropriately.

The JSON object returned by the onDataReceived method is shown below:

{
  "data":{
    "messages_sent":"2"
  }
}

e.g.

mCrewMessaging.sendMessage("Can I get a soft drink?", new CrewMessagingV1.CrewMessagingListener() {
    @Override
    public void onDataReceived(JSONObject response) {
      //This method is called once the message has been sent successfully
    }

    @Override
    public void onError(CrewMessagingV1.Error error) {
      //Method get invoked if any error occured during the sending the message
    }
});

Version 1.0