Ionic 2 push notification not working in my custom page?


#1

In my ionic app there are 2 pages. One is index.html (the default page or landing page of app). And I also have another custom page named as custom.html( a general page like index.html not present in app/pages) .
My code for receiving the push notification is written in /src/app/app.component.ts the code is as below…
var push = Push.init({ android: { senderID: “XXXXXXXXX” },
ios: { alert: “true”, badge: true, sound: ‘false’ },
windows: {} });
push.on(‘registration’, (data) => { console.log(data.registrationId); alert(data.registrationId.toString());
});
push.on(‘notification’,
(data) => {
console.log(data); alert(“Hi, Am a push notification”);
this.nav.push(CustomPage, {message: data.message});//Push page when you get data.
});

But I’m receiving notification only when I’m in index.html but not in custom.html. But I want to receive notification in both the pages … can anyone please help me ?