Class Notification
Benachrichtigung
Eine Benachrichtigung, die dem Nutzer als Reaktion auf die Interaktion mit einem UI-Element angezeigt wird.
const action = CardService.newAction().setFunctionName('notificationCallback');
CardService.newTextButton().setText('Save').setOnClickAction(action);
// ...
function notificationCallback() {
return CardService.newActionResponseBuilder()
.setNotification(
CardService.newNotification().setText('Some info to display to user'),
)
.build();
}
Methoden
Methode | Rückgabetyp | Kurzbeschreibung |
setText(text) | Notification | Hier legen Sie fest, welcher Text in der Benachrichtigung angezeigt werden soll. |
Detaillierte Dokumentation
setText(text)
Hier legen Sie fest, welcher Text in der Benachrichtigung angezeigt werden soll. Erforderlich.
Parameter
Name | Typ | Beschreibung |
text | String | Der Benachrichtigungstext. |
Rückflug
Notification
– dieses Objekt, zur Verkettung
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2024-12-21 (UTC).
[null,null,["Zuletzt aktualisiert: 2024-12-21 (UTC)."],[[["Notifications inform users about the results of their interactions, such as clicking a button."],["Developers can use `setText()` to customize the notification's message."],["The notification is triggered by a function, which is set as an action on a UI element."],["`notificationCallback()` showcases how to build and display a notification to the user."]]],["The core content details how to create and display a notification to a user interacting with a UI element. A new `Action` is created, and a `TextButton` is linked to it using `setOnClickAction`. The `notificationCallback` function, triggered by the button, builds an `ActionResponse` with a `Notification`. `setText()` method is used to set the notification message text. It takes a string and returns the `Notification` object, permitting method chaining.\n"]]