question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android localNotificationSchedule wrong date

See original GitHub issue
const date = new Date(Date.now() + (25 * 1000))

console.log(`date test: ${date}`);

PushNotification.localNotificationSchedule({
	id: '333',
	title: 'Hey',
	message: 'this is a msg!',
	priority: "max",
	autoCancel: false,
	soundName: 'popcorn.mp3',
	vibration: 30000,
	date
});
"react-native": "0.58.4",
"react-native-push-notification": "^3.1.2",
Android 5.1

date is completely ignored and the notification arrives in a random time that can even reach 5 minutes instead of the 25 seconds provided.

am I doing something wrong? how can i solve it?

Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
uhmin99commented, Feb 17, 2022

I got it solved by deleting all scheduled notification before adding new ones with same ids

PushNotification.cancelAllLocalNotifications()

0reactions
uhmin99commented, Feb 17, 2022

issue is still happening in android if you use Date to set ‘date’ option in localNotificationSchedule, ios works fine but android doesn’t show notifications in right time

Read more comments on GitHub >

github_iconTop Results From Across the Web

React native localNotificationSchedule not working for ...
I have tried to call localNotificationSchedule function to show different messages in different times in forEach loop and it works for android ......
Read more >
flutter_local_notifications | Flutter Package - Pub.dev
A cross platform plugin for displaying and scheduling local notifications for Flutter applications with the ability to customise for each platform.
Read more >
react-native-push-notification - npm
React Native Local and Remote Notifications for iOS and Android ... new Date(Date.now() + 60 * 1000), // in 60 secs allowWhileIdle: false, ......
Read more >
React Native Local Push Notifications | by Saad Khan - Medium
We will be using a very good package called react-native-push-notification. In this post, I will be showing the android part, ...
Read more >
nois/react-native-push-notification v3.1.4 - npm.io
React Native Local and Remote Notifications for iOS and Android ... < Only if you're using GCM or localNotificationSchedule() > --> <uses-permission ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found