gpt4 book ai didi

android NotificationManagerCompat.areNotificationsEnabled 不工作

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:39:17 28 4
gpt4 key购买 nike

NotificationManagerCompat.areNotificationsEnabled() 是如何工作的?我尝试执行以下操作 appPushEnabled = String.valueOf(NotificationManagerCompat.areNotificationsEnabled());
但是它给我一个错误?

它还说它只适用于某些设备,我需要尝试一下吗?

最佳答案

经过几个小时的测试,这是我的发现。

在 App Gradle 文件中,com.android.support:support 应至少为 24,compileSdkVersion 必须为 24

android {    
compileSdkVersion 24
}
dependencies {
compile 'com.android.support:support-v4:24.0.0'
}

然后@petey 的回答就会生效

NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context);
boolean areNotificationsEnabled = notificationManagerCompat.areNotificationsEnabled();

关于android NotificationManagerCompat.areNotificationsEnabled 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38016215/

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