-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Description
What am I doing wrong? This is not inside a component. I want to push a notification everytime the interval set by the user is reached.
export default function scheduleRoutine(routine) {
const message = routine.message === '' ? 'Lembrete automático' : routine.message;
BackgroundJob.register({
jobKey: routine.cod.toString(),
job: () => {
if (validateSchedule(routine)) {
PushNotification.localNotification({
title: `Sua rotina: ${routine.name}`,
message: message,
vibration: 900,
invokeApp: true,
date: new Date(Date.now() + routine.interval * 60000),
id: JSON.stringify(routine.cod),
userInfo: {id: JSON.stringify(routine.cod)},
});
cancelNotification(routine);
};
}
});
console.log('Registered Job: ', routine.cod);
BackgroundJob.schedule({
jobKey: routine.cod.toString(),
period: routine.interval * 60000,
exact: true,
allowWhileIdle: true,
});
}
prajna-h
Metadata
Metadata
Assignees
Labels
No labels