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 scheduled local notifications don't fire if there's a unique custom ID included in configuration

See original GitHub issue

If I pass a unique custom ID to my local scheduled notification, it won’t fire on Android. The scheduled notifications work fine without the custom ID.

I have configured the PushNotification handler and set up a channel. Here is the configuration for my scheduled notification:

    PushNotification.localNotificationSchedule({
      channelId: 'generic',
      vibrate: true,
      largeIcon: '',
      color: 'purple',
      vibration: 300,
      priority: 'high',
      title: 'Is it the ID!',
      message: 'Hello friend',
      date: new Date(Date.now() + 10 * 1000),
      repeatType: 'hour',
      id: '8947534524376',
    });

Am I doing something wrong?

“react”: “16.13.1”, “react-native”: “0.63.2”, “react-native-push-notification”: “^6.1.1”, “@react-native-community/push-notification-ios”: “^1.6.0”,

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
Dallas62commented, Oct 16, 2020

Hi,

Not sure you are respecting the documentation. This is not a valid integer (32bit).

1reaction
chetanbhadarkacommented, Sep 21, 2021

I also having same issue, when I set id notification was not trigger but schedule was success.

// custom ID logic from library file
const ID = Math.floor(Math.random() * Math.pow(2, 32)).toString();

const NotificationConfig = {
      channelId: 'medicine_channel',
      title: "Time to Take Medicine",
      message: "PCM",
      vibration: 300,
      repeatType: "day",
      repeatTime: 1,
      allowWhileIdle: true,
      playSound: true,
      vibrate: true,
      id: ID,
      date: new Date(Date.now() + 10 * 10000),
  }

PushNotification.localNotificationSchedule(NotificationConfig)

After schedule notification get scheduled notification

[{"data": null, "date": 2021-09-21T06:47:57.528Z, "id": "4032057797", "message": "PCM", "number": null, "repeatInterval": "day", "soundName": null, "title": "Time to Take Medicine"}]

I don’t know why this happens, if i don’t give ID into config then notification will trigger at the time. but if i gave ID then it’s not trigger but showing it’s scheduled.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create a Notification - Android Developers
Because you must create the notification channel before posting any notifications on Android 8.0 and higher, you should execute this code as soon...
Read more >
flutter_local_notifications | Flutter Package - Pub.dev
There is a limit imposed by iOS where it will only keep 64 notifications that will fire the soonest. Scheduled notifications and daylight...
Read more >
Implementing local notifications in Flutter - LogRocket Blog
Local app notifications are incredibly useful for notifying users about important information. Learn how to implement them in Flutter.
Read more >
Creating Local Notifications in Flutter - Kodeco
Learn how to create cross-platform local notifications in Flutter using the flutter_local_notifications package.
Read more >
Unity Mobile Notifications Package | 1.1.0-preview
Use the Apple Push Notification Service (APNs) to receive remote notifications. · Modify remote notification content if the device receives notifications from ...
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