Ich möchte wissen, ob meine App Benachrichtigungen anzeigen darf. Also habe ich this gefunden.Die Methode areNotificationsEnabled() ist für den Typ NotificationManagerCompat nicht definiert.
So verwende ich diese einfache Funktion in meiner app mit Eclipse und 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();
}
Aber ich bekomme einen Compiler-Fehler
Verfahren areNotificationsEnabled() ist nicht definiert für den Typ NotificationManagerCompat
Danke. https://developer.android.com/topic/libraries/support-library/revisions.html – Ton