我正在研究离子4和角铁。我的应用程序符合航班时间表。而且一切正常。但是我想做的是,如果航班到达,则要接收当地通知。在下面的“我的代码”中,我要针对一个以上的航班发出多个通知。但是当我运行应用程序时,我会收到同一航班的多个通知。我该如何为一个以上的航班进行多次通知?
代码:
async ActiveNotif() {
this.ng.run(() => {
setInterval(() => {
this.http.get('XXXXXXXXXXXXXXX&flight=' + this.id + '', {}, {})
.then(data => {
let FlightDetails = JSON.parse(data.data);
this.identification = FlightDetails.identification.callsign;
this.Fstatus = FlightDetails.status.generic.status.text;
console.log(this.Fstatus)
});
}, 5000)
if (this.Fstatus == "landed") {
this.localNotifications.schedule(
[
{
id:0,
title: 'Your flight has arrived',
text: 'Your flight ' + this.identification + ' is arrived',
trigger: { count: 1 },
sound: "file://assets/one.mp3"
},
{
id:1,
title: 'Your flight has arrived',
text: 'Your flight ' + this.identification + ' is arrived',
trigger:{count:1}
}
]);
}
})
}