diff --git a/www/push.js b/www/push.js index 8462789df..525a7bb57 100644 --- a/www/push.js +++ b/www/push.js @@ -70,6 +70,26 @@ PushNotification.prototype.unregister = function(successCallback, errorCallback, exec(successCallback, errorCallback, "PushNotification", "unregister", [options]); }; +/** + * Call this to set the application icon badge + */ + +PushNotification.prototype.setApplicationIconBadgeNumber = function(successCallback, errorCallback, badge) { + if (errorCallback == null) { errorCallback = function() {}} + + if (typeof errorCallback != "function") { + console.log("PushNotification.setApplicationIconBadgeNumber failure: failure parameter not a function"); + return + } + + if (typeof successCallback != "function") { + console.log("PushNotification.setApplicationIconBadgeNumber failure: success callback parameter must be a function"); + return + } + + cordova.exec(successCallback, errorCallback, "PushNotification", "setApplicationIconBadgeNumber", [{badge: badge}]); +}; + /** * Listen for an event. *