How to use the Communications Plugin Settings

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.

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 showDefaultQuickReplies = messagingSettingsService.includeDefaultQuickReplies.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)

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