我如何检查锁定屏幕通知是否以编程方式启用

How can i check lock screen notifcation is enabled or not programmatically

我想检查用户是否启用了锁屏通知。 设置 -> 通知 -> 锁屏通知

但是我找不到与此相关的任何代码。

试试这个:

fun getLockscreenNotificationsEnabled(context: Context) =
    android.provider.Settings.Secure.getInt(
        context.contentResolver,
        "lock_screen_show_notifications", 0
    ) != 0