Skip to content

Instantly share code, notes, and snippets.

@antidiestro
Last active August 29, 2015 14:27
Show Gist options
  • Save antidiestro/42b5537bcff7bbea4180 to your computer and use it in GitHub Desktop.
Save antidiestro/42b5537bcff7bbea4180 to your computer and use it in GitHub Desktop.
var app = angular.module('myApp', ['PlPush']);
app.config(function(PushConfigProvider){
PushConfigProvider.setGcmSenderId('Tu ID de Google GCM Sender');
});
app.run(function(PushSrv){
PushSrv.ensureRegistration(function(){
console.info('Registrado correctamente! El token de Push es ' + PushSrv.getToken());
}, function(){
console.error('Error al registrar el dispositivo.');
});
PushSrv.onMessage(function(notification){
// Haz lo que necesites con el objeto de notificación.
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment