Just wanted to share an update on my progress with a mobile application built on Ionic and utilizing Firebase as the database. One of the features I'm currently working on is implementing local notifications. Below are the code snippets:
HTML CODE
<button ion-button full (click)="scheduleNotification()">schedule</button>
<button ion-button full (click)="scheduleNotification2()">schedule</button>
This HTML code snippet contains buttons that trigger the scheduling of notifications upon clicking.
TYPESCRIPT CODE
import { Component } from '@angular/core';
import { NavController, Platform} from 'ionic-angular';
import { LocalNotifications } from '@ionic-native/local-notifications';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController, private
localNotif:LocalNotifications, private platform:Platform) {
}
scheduleNotification() {
this.platform.ready().then(()=>{
this.localNotif.schedule({
title:'Attention',
text:'Rk notification',
at: new Date(new Date().getTime() + 1 * 5000),
});
});
}
scheduleNotification2() {
this.platform.ready().then(()=>{
this.localNotif.schedule({
title:'Attention',
text:'Rk notification',
at: new Date(new Date().getTime() + 1 * 5000),
});
});
}
}
The issue I've encountered is that when I click both buttons to trigger the notifications, only one notification displays while overriding the other. My goal is to have both notifications appear without any overriding. Any suggestions on how to achieve this?