notifications.cancelNotification()

类型 函数
返回值
修订 版本 2024.3703
关键词 notification, notifications, cancelNotification(通知)
另请参阅 本地/推送通知 (指南)
notifications.scheduleNotification()
notifications.*

概述

从调度程序、状态栏和/或通知中心移除指定的通知(或所有通知)。

语法

notifications.cancelNotification( [notificationId] )
notificationId (可选)

notifications.scheduleNotification() 返回的通知引用 ID。如果没有传递 ID,则取消所有通知。

示例

local notifications = require( "plugin.notifications" )

-- Schedule a notification
local options = {
    alert = "Wake up!"
}

local notificationId = notifications.scheduleNotification( 60, options )

-- Cancel the above notification
notifications.cancelNotification( notificationId )