Skip to content

Notifications

FRVR.notifications handles two distinct things under one namespace:

  • Scheduled remote messages — the server schedules a push (or chatbot message on Facebook) to be delivered to this player at a future time.
  • Local notifications — the device fires a notification N seconds from now while the app is backgrounded.
if (await FRVR.notifications.canScheduleMessages()) {
  showReminderToggle();
}

Consent‑gated; many channels require an explicit opt‑in before you can schedule:

await FRVR.notifications.subscribeScheduleMessages();
await FRVR.notifications.scheduleMessage({
  delayInSeconds: 24 * 3600,          // 1 day
  imageUrl:       '/push/daily.png',
  message:        "Don't forget your daily reward!",
  playerId:       FRVR.profile.id(),
  buttons: [
    { type: 'postback', title: 'Play now', payload: JSON.stringify({ deepLink: 'daily' }) },
  ],
});

The buttons[].payload shows up in entry point data when the player arrives through the notification.

Useful for short‑term reminders — e.g. “your energy is full in 30 minutes”:

FRVR.notifications.scheduleLocalNotification(
  'energy_full',                       // code (used to cancel/replace)
  'Energy full!',                      // title
  'Come back and play a few rounds',   // body
  30 * 60,                             // seconds
);

Notifications: availability + subscribe

loading SDK…