EddyVerbruggen / nativescript-local-notifications

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

Can I pass id as a string or an object? #181

Closed dungfv closed 4 years ago

dungfv commented 4 years ago

I use LocalNotification to display push notifications from firebase. Sometimes I need to save more data to process the corresponding message. This code prevents that. Why id must always be of the number?

  var id = opts.id;
  if (typeof id === "number") {
            return 
  } else {
            return opts.id = LocalNotificationsCommon.generateNotificationID();
  }
EddyVerbruggen commented 4 years ago

Because the native API requires it to be an int: https://developer.android.com/reference/androidx/core/app/NotificationManagerCompat.html#notify(int,%20android.app.Notification)