Guest User

Untitled

a guest
Jun 17th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <platform name="ios">
  2. <resource-file src="GoogleService-Info.plist" />
  3. </platform>
  4. <plugin name="phonegap-plugin-push" spec="^2.2.3">
  5. <variable name="SENDER_ID" value="931157632289" />
  6. </plugin>
  7.  
  8. platform.ready().then(() => {
  9.  
  10. statusBar.styleDefault();
  11. splashScreen.hide();
  12. alert('TESTE1');
  13. this.push.hasPermission()
  14. .then((res: any) => {
  15. if (res.isEnabled) {
  16. alert('We have permission to send push notifications');
  17.  
  18.  
  19.  
  20. } else {
  21. alert('We do not have permission to send push notifications');
  22. const options: PushOptions = {
  23. android: {},
  24. ios: {
  25. alert: 'true',
  26. badge: true,
  27. sound: 'false'
  28. },
  29. windows: {},
  30. browser: {
  31. pushServiceURL: 'http://push.api.phonegap.com/v1/push'
  32. }
  33. };
  34.  
  35. const pushObject: PushObject = this.push.init(options);
  36.  
  37.  
  38. pushObject.on('notification').subscribe((notification: any) => {
  39. alert(notification.message);
  40. });
  41.  
  42. pushObject.on('registration').subscribe((registration: any) =>{
  43. alert( registration);
  44. });
  45.  
  46. pushObject.on('error').subscribe(error =>{
  47. alert(error);
  48. });
  49.  
  50. }
  51.  
  52. });
  53.  
  54.  
  55.  
  56. });
Add Comment
Please, Sign In to add comment