|
@@ -26,6 +26,7 @@ package de.appplant.cordova.plugin.notification;
|
|
|
import android.app.NotificationManager;
|
|
import android.app.NotificationManager;
|
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
|
import android.content.SharedPreferences;
|
|
import android.content.SharedPreferences;
|
|
|
|
|
+import android.support.v4.app.NotificationManagerCompat;
|
|
|
|
|
|
|
|
import org.json.JSONException;
|
|
import org.json.JSONException;
|
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
@@ -68,6 +69,13 @@ public class Manager {
|
|
|
return new Manager(context);
|
|
return new Manager(context);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Check if app has local notification permission.
|
|
|
|
|
+ */
|
|
|
|
|
+ public boolean hasPermission () {
|
|
|
|
|
+ return getNotMgrCompat().areNotificationsEnabled();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Schedule local notification specified by JSON object.
|
|
* Schedule local notification specified by JSON object.
|
|
|
*
|
|
*
|
|
@@ -454,5 +462,12 @@ public class Manager {
|
|
|
return (NotificationManager) context
|
|
return (NotificationManager) context
|
|
|
.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Notification manager compat for the application.
|
|
|
|
|
+ */
|
|
|
|
|
+ private NotificationManagerCompat getNotMgrCompat () {
|
|
|
|
|
+ return NotificationManagerCompat.from(context);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|