Advertisement
Guest User

Untitled

a guest
Aug 19th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. .run(function($ionicPlatform, $rootScope) {
  2. $ionicPlatform.ready(function() {
  3. var push = PushNotification.init({
  4. android: {
  5. senderID: "411587591993"
  6. },
  7. browser: {
  8. pushServiceURL: 'http://push.api.phonegap.com/v1/push'
  9. },
  10. ios: {
  11. alert: "true",
  12. badge: "true",
  13. sound: "true"
  14. },
  15. windows: {}
  16. });
  17. push.on('registration', function(data) {
  18. console.log("Device Token: " + data.registrationId);
  19. $rootScope.devToken = data.registrationId;
  20. })
  21. push.on('notification', function(data) {
  22. if (data.additionalData.foreground) {
  23. alert(data.message);
  24. }
  25. })
  26. push.on('error', function(e) {
  27. console.log(e.message);
  28. });
  29. });
  30. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement