【问题标题】:How can i check lock screen notifcation is enabled or not programmatically如何以编程方式检查锁定屏幕通知是否启用
【发布时间】:2022-01-04 14:54:05
【问题描述】:

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

但我找不到任何关于此的代码。

【问题讨论】:

    标签: java android android-studio settings


    【解决方案1】:

    试试这个:

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

    【讨论】:

    • 它正在工作。非常感谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-13
    • 2011-02-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多