gpt4 book ai didi

android - 我如何以编程方式知道 Android O 上是否启用了通知 channel ?

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:26:32 24 4
gpt4 key购买 nike

查看文档我可以看到检查通知 channel 所有属性的方法,但我找不到检查 channel 本身是启用还是禁用的方法。

我错过了什么吗?

最佳答案

Official Documentation有你的答案:

You can call the following two methods to discover the settings a user has applied to a notification channel:

  • o retrieve a single notification channel, you can call getNotificationChannel().
  • To retrieve all notification channels belonging to your app, you can call getNotificationChannels().

After you have the NotificationChannel, you can use methods such as getVibrationPattern() and getSound() to find out what settings the user currently has. To find out if a user blocked a notification channel, you can call getImportance(). If the notification channel is blocked, getImportance() returns IMPORTANCE_NONE.

因此 getImportance() 会告诉您通知 channel 是否被阻止。

关于android - 我如何以编程方式知道 Android O 上是否启用了通知 channel ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46670402/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com