Expected Behaviour
When the user receives a notification and click on it and the application is closed or in background the app should open a page with the information refered to the notification.
If the app is running it should create an alert message and then the user can choose if he wants to see or ignore the notification details
Actual Behaviour
After installing the app and allowing notifications, when the app is open or in backgroung, it works like the expected behaviour, but after closing the application I still received the notifications but when I click on it, it only opens the app, it doesn’t execute any of the actions I create. Even with the app opened or in background the expected behavior stop working.
Reproduce Scenario (including but not limited to)
Just need to install the app and then close it. The expected behavior stop working after that.
Steps to Reproduce
Just need to install the app and then close it. The expected behavior stop working after that.
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
iOS 10.2 and iOS 10.2.1
(Android) What device vendor (e.g. Samsung, HTC, Sony…)
Cordova CLI version and cordova platform version
6.4.0
Plugin version
1.9.2
Sample Push Data Payload
{ "tokens": ["****"],
"profile": "****",
"notification": {
"title": "Let's Run Away",
"message": "Roteiro: Madrid",
"payload": { "postID": "1561584567277854524" },
"ios": { "sound": "default" },
"android": { "sound": "default" }
}
}
Sample Code that illustrates the problem
this.push.register().then((t: PushToken) => {
return this.push.saveToken(t);
}).then((t: PushToken) => {
console.log('Token saved:', t.token);
});
this.push.rx.notification()
.subscribe((msg) => {
let postID = msg.payload["postID"];
let post = true;
let postMessage = msg.text;
//if user using app and push notification comes
if (!msg.app.asleep && !msg.app.closed) {
// if application open, show popup
let confirmAlert = this.alertCtrl.create({
title: msg.title,
message: postMessage,
buttons: [{
text: 'Ignorar',
role: 'cancel',
handler: data => {
Mixpanel.track("Ignorou notificação");
}
}, {
text: 'Abrir',
handler: () => {
Mixpanel.track("Abriu notificação-App Aberta");
this.LRAPage.getPreferedPost(postID).subscribe(response => {
this.navCtrl.push(PostPage, {item: response});
});
}
}]
});
confirmAlert.present();
} else {
this.LRAPage.getPreferedPost(postID).subscribe(response => {
this.navCtrl.push(PostPage, {item: response});
});
}
});
Logs taken while reproducing problem
N/A (I can only receive notifications when the application was installed from TestFlight, and I don’t know how to see logs here)