Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

`expo-notifications` scheduleNotificationAsync not working as expected in device

$
0
0

My app is of expo bare workflow.

Using latest expo & expo notifications.

"expo": "^39.0.0","expo-notifications": "~0.7.2",

Problem

Im im trying to schedule a repeat notification on everyday morning 9AM & night 9PM everyday. One Everytime use user opens app, im cancelling all old notifications & scheduling new one, (tried with checking scheduled notification, if not exist schedule new). This seems to be working fine in android simulator, when i install app in phone it triggers notification very rarely or some times nothing for a week. I have just followed given documentation for repeat local notifications. Need help...

Code

// Cancel All notificationsawait Notifications.cancelAllScheduledNotificationsAsync();//9AM notification        await Notifications.scheduleNotificationAsync({            identifier: 'morning-1',            content: {                title: `Good Morning!`,                subtitle: 'Greetings',                body: `Have a great day`,                sound: true,                color: "#ffffff",                data: {                    to: 'new-log'                }            },            trigger: {                hour: 9,                minute: 0,                repeats: true            }        });   //9PM notification    await Notifications.scheduleNotificationAsync({                identifier: 'night-notification',                content: {                    title: `Good Night :)`,                    subtitle: 'Have a great sleep :D',                    body: `Have a great sleep :D',                    sound: true,                    data: {                        to: 'new-log'                    },                    color: "#000000"                },                trigger: {                    hour: 21,                    minute: 0,                    repeats: true                }            });

But it doesn't trigger notifications properly, what i observed, it will show notifications like 3 days once or weekly once or sometimes nothing. it is not trigger on given time at all.


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>