Class Notification

  • Notifications are displayed to users after interacting with a UI element.

  • Notifications are created using CardService.newNotification() and can be set with setText(text).

  • The setText(text) method is required and sets the string content of the notification.

Notification

A notification shown to the user as a response to interacting with a UI element.

constaction=CardService.newAction().setFunctionName('notificationCallback');
CardService.newTextButton().setText('Save').setOnClickAction(action);
// ...
functionnotificationCallback(){
returnCardService.newActionResponseBuilder()
.setNotification(
CardService.newNotification().setText('Some info to display to user'),
)
.build();
}

Methods

MethodReturn typeBrief description
setText(text) Notification Sets the text to show in the notification.

Detailed documentation

setText(text)

Sets the text to show in the notification. Required.

Parameters

NameTypeDescription
textStringThe notification text.

Return

Notification — This object, for chaining.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年12月03日 UTC.