How to use the Communications Plugin Settings

Last edit: 2023.12.06

The IVI platform comes with a MessagingAppSettingsService that provides settings for quick replies that can be exposed to end-users. The current settings include:

  • A boolean that indicates whether the quick replies of a message notification should include default quick replies.
  • A boolean that indicates whether the quick replies of a message notification should include
  • custom quick replies.
  • A list of custom quick replies defined by the user.
  • A priority level MessageStackNotificationPriority for incoming message notifications from a known sender.
  • A priority level MessageStackNotificationPriority for incoming message notifications from an unknown sender.

Reading a setting

To read a setting, you first need to create a MessagingAppSettingsService:

private val messagingSettingsService =
MessagingAppSettingsService.createApi(this, frontendContext.iviServiceProvider)

Now you can get to the value you want to read:

1val quickRepliesList = messagingSettingsService.quickReplies.value
2val showCustomQuickReplies = messagingSettingsService.includeCustomQuickReplies.value
3val notificationPriorityFromKnownSender = messagingSettingsService.notificationPriorityForMessagesFromKnownSender.value
4val notificationPriorityFromUnknownSender = messagingSettingsService.notificationPriorityForMessagesFromUnknownSender.value

Updating a setting

To update a setting, you first need to create a MessagingAppSettingsService:

private val messagingSettingsService =
MessagingAppSettingsService.createApi(this, frontendContext.iviServiceProvider)

Now you can update the value stored in the settings:

1messagingSettingsService.updateQuickRepliesAsync(quickRepliesList)
2messagingSettingsService.updateIncludeDefaultQuickRepliesAsync(value)
3messagingSettingsService.updateIncludeCustomQuickRepliesAsync(value)
4messagingSettingsService.updateNotificationPriorityForMessagesFromKnownSenderAsync(priority)
5messagingSettingsService.updateNotificationPriorityForMessagesFromUnknownSenderAsync(priority)

Here, quickRepliesList must be of type List<String>, value must be of type Boolean and the priority must be of type MessageStackNotificationPriority. Note that updating a value overrides the value currently stored in the setting.