Advertisement
Guest User

Untitled

a guest
Jul 15th, 2017
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. /////////////////
  2. /////////////////
  3. app.component.ts
  4. /////////////////
  5. /////////////////
  6. `import { Component } from '@angular/core';
  7. import { Platform} from 'ionic-angular';
  8. import { StatusBar } from '@ionic-native/status-bar';
  9. import { SplashScreen } from '@ionic-native/splash-screen';
  10.  
  11. import { TabsPage } from '../pages/tabs/tabs';
  12. import { Push, PushToken } from '@ionic/cloud-angular';
  13.  
  14. @Component({
  15. templateUrl: 'app.html'
  16. })
  17. export class MyApp {
  18. rootPage:any = TabsPage;
  19.  
  20. constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, public push: Push) {
  21. platform.ready().then(() => {
  22.  
  23. statusBar.styleDefault();
  24. splashScreen.hide();
  25.  
  26. this.push.register().then((t: PushToken) => {
  27. return this.push.saveToken(t);
  28. }).then((t: PushToken) => {
  29. console.log('Token saved:', t.token);
  30. });
  31.  
  32. this.push.rx.notification()
  33. .subscribe((msg) => {
  34. alert(msg.title + ': ' + msg.text);
  35. });
  36. });
  37.  
  38. }
  39. }
  40. `
  41. /////////////////
  42. /////////////////
  43. app.module.ts
  44. /////////////////
  45. /////////////////
  46.  
  47. import { CloudSettings, CloudModule } from '@ionic/cloud-angular';
  48.  
  49. const cloudSettings: CloudSettings = {
  50. 'core': {
  51. 'app_id': 'XXXXXX'
  52. },
  53. 'push': {
  54. 'sender_id': 'XXXXX',
  55. 'pluginConfig': {
  56. 'ios': {
  57. 'badge': true,
  58. 'sound': true
  59. },
  60. 'android': {
  61. 'iconColor': '#ff0000'
  62. }
  63. }
  64. }
  65. };
  66.  
  67.  
  68. @NgModule({
  69. declarations: [
  70. MyApp,
  71. ContactPage,
  72. HomePage,
  73. TabsPage,
  74. Account,
  75. LastRatingPage,
  76. MyInformationPage,
  77. SettingNotifPage,
  78. LoginPage,
  79. RegisterPage,
  80. MenuPage,
  81. MyRatingPage,
  82. IntroPage
  83. ],
  84. imports: [
  85. BrowserModule,
  86. HttpModule,
  87. IonicModule.forRoot(MyApp),
  88. IonicStorageModule.forRoot(),
  89. CloudModule.forRoot(cloudSettings)
  90.  
  91.  
  92. ],
  93. bootstrap: [IonicApp],
  94. entryComponents: [
  95. MyApp,
  96. ContactPage,
  97. HomePage,
  98. TabsPage,
  99. Account,
  100. LastRatingPage,
  101. MyInformationPage,
  102. SettingNotifPage,
  103. LoginPage,
  104. RegisterPage,
  105. MenuPage,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement