After testing for few hours, here is what I have found.
In App Gradle file, com.android.support:support should be minimum 24 and compileSdkVersion has to be 24
android {
compileSdkVersion 24
}
dependencies {
compile 'com.android.support:support-v4:24.0.0'
}
And then @petey 's answer will be working
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context);
boolean areNotificationsEnabled = notificationManagerCompat.areNotificationsEnabled();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…