[CB-313] Enhanced Notification API missing
diff --git a/lib/android/platform.js b/lib/android/platform.js
index 6c71820..c2dc309 100644
--- a/lib/android/platform.js
+++ b/lib/android/platform.js
@@ -127,5 +127,14 @@
MediaError: { // exists natively on Android WebView on Android 4.x
path: "cordova/plugin/MediaError"
}
+ },
+ merges: {
+ navigator: {
+ children: {
+ notification: {
+ path: 'cordova/plugin/android/notification'
+ }
+ }
+ }
}
};
diff --git a/lib/android/plugin/android/notification.js b/lib/android/plugin/android/notification.js
new file mode 100755
index 0000000..fe21d33
--- /dev/null
+++ b/lib/android/plugin/android/notification.js
@@ -0,0 +1,53 @@
+var exec = require('cordova/exec');
+
+/**
+ * Provides Android enhanced notification API.
+ */
+module.exports = {
+ activityStart : function(title, message) {
+ // If title and message not specified then mimic Android behavior of
+ // using default strings.
+ if (typeof title === "undefined" && typeof message == "undefined") {
+ title = "Busy";
+ message = 'Please wait...';
+ }
+
+ exec(null, null, 'Notification', 'activityStart', [ title, message ]);
+ },
+
+ /**
+ * Close an activity dialog
+ */
+ activityStop : function() {
+ exec(null, null, 'Notification', 'activityStop', []);
+ },
+
+ /**
+ * Display a progress dialog with progress bar that goes from 0 to 100.
+ *
+ * @param {String}
+ * title Title of the progress dialog.
+ * @param {String}
+ * message Message to display in the dialog.
+ */
+ progressStart : function(title, message) {
+ exec(null, null, 'Notification', 'progressStart', [ title, message ]);
+ },
+
+ /**
+ * Close the progress dialog.
+ */
+ progressStop : function() {
+ exec(null, null, 'Notification', 'progressStop', []);
+ },
+
+ /**
+ * Set the progress dialog value.
+ *
+ * @param {Number}
+ * value 0-100
+ */
+ progressValue : function(value) {
+ exec(null, null, 'Notification', 'progressValue', [ value ]);
+ },
+};
\ No newline at end of file