1
我想知道我的應用程序是否被允許顯示通知。所以我找到了this。方法areNotificationsEnabled()未定義類型NotificationManagerCompat
於是我就用我的應用程序這個簡單的功能使用Eclipse,和android:targetSdkVersion = 「24」
@TargetApi(24)
static boolean AreNotificationsEnabledForMyApp(Context myContext) {
if (Build.VERSION.SDK_INT < 24)
return true; //there is no way to know this in earlier Android releases so I return true.
NotificationManagerCompat nmc = NotificationManagerCompat.from(myContext);
return nmc.areNotificationsEnabled();
}
但我得到一個編譯錯誤
的方法areNotificationsEnabled()是未定義對於類型 NotificationManagerCompat
謝謝。 https://developer.android.com/topic/libraries/support-library/revisions.html – Ton