Class Notification
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Notifikasi
Notifikasi yang ditampilkan kepada pengguna sebagai respons terhadap interaksi dengan elemen UI.
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();
}
Metode
Metode | Jenis hasil yang ditampilkan | Deskripsi singkat |
setText(text) | Notification | Menetapkan teks yang akan ditampilkan dalam notifikasi. |
Dokumentasi mendetail
setText(text)
Menetapkan teks yang akan ditampilkan dalam notifikasi. Wajib.
Parameter
Nama | Jenis | Deskripsi |
text | String | Teks notifikasi. |
Pulang pergi
Notification
— Objek ini, untuk pembuatan rantai.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-26 UTC."],[],["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"],null,[]]