EddyVerbruggen / nativescript-local-notifications

:mailbox: NativeScript plugin to easily schedule local notifications
MIT License
162 stars 57 forks source link

Problems with notification id #137

Closed guzz closed 5 years ago

guzz commented 5 years ago

The notifications when created get a new id the the system creates automatically no matter what id I put in my notification.

When I call the getScheduledIds() method, the ids that show up are not the same that I get when the user clicks on the notification inside the addOnMessageReceivedCallback callback so it is impossible to know which notification is being clicked.

In the getScheduledIds() method I get all id´s negative like -549521321654 but when I get it from the click callback the id is always positive, and a different number.

lord-zeus commented 5 years ago

Got similar problem application sets its own id which is different from the one I give to it

MopheusDG commented 5 years ago

Same problem for me, quite crazy ID's actually:

JS: ID's: -931032346,-934783024,-933941899,-937974642,-935749272,-934308609,-919 366020,-917339210,-916723179

Any workaround to identify the schedules created ?

EddyVerbruggen commented 5 years ago

iOS, Android, or both?

MopheusDG commented 5 years ago

I only tested on Android so far, will try to check on iOS tomorrow (Don't have a mac here).

MopheusDG commented 5 years ago

By the way, is there any way to get all the schedule ID's with the AT date included ? Thanks @EddyVerbruggen

EddyVerbruggen commented 5 years ago

I've always passed in the id's myself so didn't really see this issue on Android (add id: 2 to the notification payload of the schedule function), but I've now fixed it so the generated ids aren't so weird.

Also, the promise of schedule will now contain the (potentially generated) id's (similar to getScheduledIds).

And no, currently there's no way to get the date of scheduled notifications. Perhaps a getScheduledNotifications function can be added, but you might as well remember those dates in your own code.