React-native-firebase: scheduleLocalNotification() not working

Created on 8 Jun 2017  路  6Comments  路  Source: invertase/react-native-firebase

Hey !

I'm trying to fire a scheduled local notification as so :

firebase.messaging().scheduleLocalNotification({
  title: 'Title',
  body: 'Body',
  icon: "ic_launcher",
  large_icon: "ic_launcher",
  color: "#234a75",
  fire_date: moment().valueOf() + 1000 * 5,
  id: Math.floor((Math.random() * 500) + 0).toString(),
  show_in_foreground: true,
})

But the notification is never triggered (tested on Android).

Is there something I am missing ? createLocalNotification() works perfectly well with the same parameters (without id and fire_date of course).

Thank you for your amazing work.

All 6 comments

@Kernael Have you tried setting the fire_date as slightly further in the future?
I seem to recall having a similar issue where it takes a little while for the notification to be registered. Try a minute or two rather than a few seconds?

No luck so far with fire_date: moment().add(2, 'minutes').valueOf().

Figured it out, it came from a missing configuration as documented here : http://invertase.io/react-native-firebase/#/installation-android?id=_3-cloud-messaging-optional

Fantastic - glad you got there!

@chrisbianca This thread helped me sorted this out, however I couldn't find this method in the docs. Is it possible to update and add this information? The scheduleLocalNotification and createLocalNotification are not in the messaging reference.

@sfratini if you're looking at v4 then they're in the notifications reference docs

Was this page helpful?
0 / 5 - 0 ratings