Let's say I am building an app that sends push notifications with react-native-fcm using data retrieved from a weather API.
currently, I have this script, but the notifications sent only contains weather information that I retrieved before scheduling, not the most current weather:
FCM.scheduleLocalNotification({
fire_date: moment().add(5, 'seconds').toDate().getTime(),
id: '1q2we3',
body: `${ ...weatherInfo... }`,
repeat_interval: 'hour',
show_in_foreground: true
});
even if I were to place 'body' with Date.now(), the notifications sent later will have the date string at the time of scheduling the notification, not the time of the notification being pushed.
TLDR:
Basically I was wondering if it was possible to schedule local push notifications that fetches data before sending the message. If not, what are my alternatives? Thanks in advance!