evollu / react-native-fcm

react native module for firebase cloud messaging and local notification
MIT License
1.73k stars 681 forks source link

Not getting scheduled notifications #799

Open kckunal2612 opened 6 years ago

kckunal2612 commented 6 years ago
  1. What version of RN and react-native-fcm are you running? react-native: "0.50.3", react-native-fcm": "11.1.0

  2. What device are you using? (e.g iOS9 emulator, Android 6 device)? - Android 6 Emulator (Marshmallow)

  3. Is your app running in foreground, background or not running? - Running in Foreground


I am scheduling notifications as follows -

 FCM.scheduleLocalNotification({
            fire_date: new Date().getTime(),      
            id: "UNIQ_ID_STRING",
            body: "BODY",
            show_in_foreground:true,
            title:"TITLE"
        });

However, I am not getting any notifications (which I should get immediately according to the value of fire_date set by me.

But when I run presentLocalNotification(), it immediately presents a notification.


 FCM.presentLocalNotification({
            fire_date: new Date().getTime(),
            id: "UNIQ_ID_STRING",
            body: "BODY",
            show_in_foreground:true,
            title:"TITLE"
        });

What could be the problem here ? I tried to replicate this with the Example Repo but it worked there. Are there any specific requirements to scheduling notifications ?

evollu commented 6 years ago

try add couple seconds for fire_date