Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

ml-archive/nodes-fe-nParsePushNotifications

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

nParsePushNotifications

Not maintained by Nodes anymore

Angular wrapper for push notifications with phonegap/phonegap-plugin-push using Parse.com

Configuration

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'
		}
	});

Init

nParsePushNotifications.init().then(function() {
    // Do something
});

Subscribe channel

nParsePushNotifications.subscribe('CHANNEL').then(function(channels) {
    // Do something
});

Unsubscribe channel

nParsePushNotifications.unsubscibe('CHANNEL').then(function(channels) {
    // Do something
});

Unsubscribe all channels

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
});

Unregister push notifications

nParsePushNotifications.unregister().then(function() {
    // Do Something
});

Has permission?

nParsePushNotifications.hasPermission().then(function(hasPermission) {
    if(hasPermission) {
        // Perfect
    } else {
        // Do something
    }
});

Listen for notifications

$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) );
});

About

Angular wrapper for phonegap/phonegap-plugin-push which $emits notifications like ng-cordova (Requires Ionic)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published