I’m trying to implement Local Notifications in Ionic 2, but it doesn’t seem to work properly. This is the code I’m using:
onPageWillEnter() {
this.backend.getNotificationTime()
.subscribe(data => {
this.notificationTime = data;
var time = new Date();
time.setHours(this.notificationTime.hour);
time.setMinutes(this.notificationTime.minute);
time.setSeconds(this.notificationTime.second);
LocalNotifications.schedule({
id: 1,
title: "Title",
text: "Lorem ipsum",
firstAt: time,
every: "day",
led: "ff5454",
sound: 'notification.mp3',
icon: "img/notification.png",
});
});
}
So this retrieves a time for the notification to appear from an API. The notification doesn’t show up when my phone is locked. The LED, sound and icon are also not working. Am I missing something? I’m testing on Android 6 in case that matters. The notification.mp3 and img/notification.png are in the www folder.