CancelLocalNotifications doesn’t work on Android in a new version


Faced with an issue after update to a newest version: react-native-push-notification”: “^7.0.0”
When i creating scheduled notifications and trying to cancel it – it creates anyway and i can’t cancel it.
For iOS it works fine, but for scheduling notifications i’m using there PushNotificationIOS.addNotificationRequest, for android i’m using localNotificationSchedule.

Environment info

“react-native”: “0.62.1”,
@react-native-community/push-notification-ios”: “^1.8.0”,
Library version: 7.0.0

Steps To Reproduce

  1. PushNotification.localNotificationSchedule() with delay for 5 seconds
  2. then call cancelLocalNotifications with ids of scheduled notifications

1 possible answer(s) on “CancelLocalNotifications doesn’t work on Android in a new version

  1. Hi @Dallas62 ,

    I was able to reproduce the same issue if I create a scheduled notification with id as null, but If I generate a random ID then the notifications were canceled properly. I believe it has something to do with generating the notification ID automatically.

    { id: parseInt(Math.random()*1000000000, 10).toString(), title: 'Hello', message: 'World', }

    The above code worked for me.