Last active
August 29, 2015 14:27
-
-
Save antidiestro/42b5537bcff7bbea4180 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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