Hi,
My app schedules a set of notifications for the entire week. The notifications have the following shape:
createChannelAndroid: function createChannelAndroid(channelId, snackID) {
if (Platform.OS === 'android') {
Expo.Notifications.createChannelAndroidAsync(channelId, {
name: `Next snack - ${snackID}`,
sound: true,
vibrate: [0, 500],
});
}
},
createSnackNotificationProps: function createSnackNotificationProps(snack, channelId) {
return {
title: `Es la hora de tu ${snackName()}`,
body: snack.name,
data: {},
android: {
channelId,
icon: '../.././assets/images/icon.png',
},
ios: {
sound: true,
},
};
},
notifyOneSnack: async function notifyOneSnack(snackFormPlan) {
const channelId = `snack_${snackFormPlan.snack}`;
snackFunctions.createChannelAndroid(channelId, snackFormPlan.snack);
const notifTime = getCompleteTimeForSnack(snackFormPlan);
if (notifTime.isBefore(moment())) {
return null;
}
const snackNotification = snackFunctions.createSnackNotificationProps(snackFormPlan.snack, channelId);
console.log(`Scheduling snack for ${notifTime.format()}`);
const notifSchedule = await Expo.Notifications.scheduleLocalNotificationAsync(snackNotification, { time: notifTime.toDate() });
const snackFromPlanID = snackFormPlan._id;
return { notificationId: notifSchedule, snackFromPlanID };
},
I am not 100% sure because testing notifications is a hell of a task, but I’m feeling that all the notifications stop triggering if I reboot the phone.
Is this possible? How do I solve it?
Thanks!