Not maintained by Nodes anymore
Angular wrapper for push notifications with phonegap/phonegap-plugin-push using Parse.com
Configuration can be done by the provider inside your Angular module config. You can see the full list of configureable options here
nParsePushNotificationsConfigProvider.configure({
android: {
senderID: "SENDER-ID"
},
ios: {
alert: "true",
badge: "true",
sound: "true"
},
parse: {
appID: 'PARSE-APP-ID',
key: 'PARSE-REST-KEY'
}
});
nParsePushNotifications.init().then(function() {
// Do something
});
nParsePushNotifications.subscribe('CHANNEL').then(function(channels) {
// Do something
});
nParsePushNotifications.unsubscibe('CHANNEL').then(function(channels) {
// Do something
});
Beware that this doesn't unsubscribe the broadcast channel. If you wanna disable push notifications entirely, you should you the unregister method.
nParsePushNotifications.unsubcribeAll().then(function(channels) {
// Do something
});
nParsePushNotifications.unregister().then(function() {
// Do Something
});
nParsePushNotifications.hasPermission().then(function(hasPermission) {
if(hasPermission) {
// Perfect
} else {
// Do something
}
});
$rootScope.$on('$cordovaPush:notificationReceived', function(event, notification) {
alert( 'PUSH!!' + JSON.stringify(notification) );
});
$rootScope.$on('$cordovaPush:errorOccurred', function(event, error) {
alert( 'PUSH ERROR!!' + JSON.stringify(error) );
});