I trying to add push notications on my app but I always have this error
Error TS2345: Argument of type ‘{ android: { senderID: string; }; browser: { pushServiceURL: string; }; ios: { alert: string; bad…’ is not assignable to parameter of type ‘PushOptions’.
I follow this documentation : http://ionicframework.com/docs/v2/native/push/
this is my code:
import {Component, ViewChild} from '@angular/core';
import {ionicBootstrap, Platform, MenuController, Nav} from 'ionic-angular';
import {StatusBar} from 'ionic-native';
import {HelloIonicPage} from './pages/hello-ionic/hello-ionic';
import {ListPage} from './pages/list/list';
import {HeroListPage} from './pages/hero-list/hero-list';
import {AddHeroPage} from './pages/add-hero/add-hero';
import {ExempleApiPage} from './pages/exemple-api/exemple-api';
import { HTTP_PROVIDERS } from '@angular/http';
import { Push } from 'ionic-native';
@Component({
templateUrl: 'build/app.html'
})
class MyApp {
@ViewChild(Nav) nav: Nav;
// make HelloIonicPage the root (or first) page
rootPage: any = HelloIonicPage;
pages: Array<{title: string, component: any}>;
constructor(
private platform: Platform,
private menu: MenuController
) {
this.initializeApp();
// set our app's pages
this.pages = [
{ title: 'Accueil', component: HelloIonicPage },
{ title: 'Liste des Héros', component: HeroListPage },
{ title: 'Ajouter Héro', component: AddHeroPage },
{ title: 'Exemple Api', component: ExempleApiPage }
];
}
initializeApp() {
this.platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
let push = Push.init({
android: {
senderID: '695445385707'
},
browser: {
pushServiceURL: 'http://push.api.phonegap.com/v1/push'
},
ios: {
alert: "true",
badge: true,
sound: 'false'
},
windows: {}
});
push.on('registration', (data) => {
console.log(data.registrationId);
});
push.on('notification', function(data) {
console.log(data.message);
console.log(data.title);
console.log(data.count);
console.log(data.sound);
console.log(data.image);
console.log(data.additionalData);
});
push.on('error', (e) => {
console.log(e.message);
});
});
}
openPage(page) {
// close the menu when clicking a link from the menu
this.menu.close();
// navigate to the new page if it is not the current page
this.nav.setRoot(page.component);
}
}
ionicBootstrap(MyApp,[HTTP_PROVIDERS]);