Class Notification
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
اعلان اعلانی که به عنوان پاسخی به تعامل با یک عنصر رابط کاربری به کاربر نشان داده میشود.
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();
} مستندات دقیق
setText(text)
متن نمایش داده شده در اعلان را تنظیم میکند. الزامی است.
پارامترها
| نام | نوع | توضیحات |
|---|
text | String | متن اعلان. |
بازگشت
Notification — این شیء، برای زنجیرهسازی.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2026-04-13 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2026-04-13 بهوقت ساعت هماهنگ جهانی."],[],["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"]]