I’m using Ionic RC4 ith cloud service, this is my code which reference from doc: https://docs.ionic.io/services/push/
(The phonegap-plugin-push
has installed)
platform.ready().then(() => {
StatusBar.styleDefault();
Splashscreen.hide();
this.push.register().then((t: PushToken) => {
console.log('This scope will never executed.');
return this.push.saveToken(t, {ignore_user: true});
}).then((t: PushToken) => {
alert(t.token); // I add an alert to check token registered, but also not executed.
console.log('Token saved:', t.token);
});
this.push.rx.notification()
.subscribe((msg) => {
alert(msg.title + ': ' + msg.text);
});
});
I added an alert to check the token registered or not, but I always unable to get any response of push.register()
, the code in then()
didn’t executed without any error messages or console logs.
I tried in browser, Ionic View and iOS simulator, they are all no works. Also, I add a push notification from apps.ionic.io
but it still can not receive any notifications.
Any one have ideas?