我正在尝试使用
NotificationManagerCompat.from(this).areNotificationsEnabled()
确定我的应用是否允许推送通知。但是它没有使用此错误进行编译:
error: cannot find symbol
Log.d(TAG, "Allowed PushNotes: " + NotificationManagerCompat.from(this).areNotificationsEnabled());
^
symbol: method areNotificationsEnabled()
location: class NotificationManagerCompat
它是这样导入的:
import android.support.v4.app.NotificationManagerCompat;
这些是build.gradle的相关部分,我想:
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example"
minSdkVersion 16
targetSdkVersion 22
versionCode 10
versionName "1.9"
ndk {
abiFilters "armeabi-v7a", "x86"
}
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
}
这就是依赖:
dependencies {
compile "com.android.support:appcompat-v7:23.4.0"
答案 0 :(得分:0)
编译“com.android.support:support-v4:24.0.0”
答案 1 :(得分:0)
在App Gradle文件中,com.android.support:support
应至少为24
compileSdkVersion
必须为24
android {
compileSdkVersion 24
}
dependencies {
compile 'com.android.support:support-v4:24.0.0'
}