With the above workaround, the first notification is displayed, but any following notification is not and there's this error message: Error in LocalNotifications.schedule: TypeError: iconLocation.indexOf is not a function. This is because the LocalNotificationsCommon.merge() function was rewritten in a way that it modifies one of the objects passed as arguments, as opposed to returning a new object with the merged properties and leaving the argument objects unchanged. Confusingly, the function modifies the source argument instead of the target. This causes the LocalNotificationsImpl.defaults object to be modified here.
You can workaround this issue by passing these two options with their default values explicitly:
Since 6.2.0 (https://github.com/NativeScript/plugins/commit/ed5feb9f85135a3d64a86ef8da5b44f344b1698e in particular) the
schedule()
function doesn't show any notification if all optional parameters of thescheduleOptions
object are omitted. It worked fine with the previous version 6.1.1.There are two separate problems:
at
option, its value now defaults to-1
instead of0
: https://github.com/NativeScript/plugins/blob/ed5feb9f85135a3d64a86ef8da5b44f344b1698e/packages/local-notifications/index.android.ts#L207 This causes notifications to never show and there is no error message. Thecom.telerik.localnotifications
package expects0
for notifications that are supposed to be displayed immediately: https://github.com/EddyVerbruggen/nativescript-local-notifications/blob/master/native-src/android/app/src/main/java/com/telerik/localnotifications/NotificationRestoreReceiver.java#L52 Workaround:Error in LocalNotifications.schedule: TypeError: iconLocation.indexOf is not a function
. This is because theLocalNotificationsCommon.merge()
function was rewritten in a way that it modifies one of the objects passed as arguments, as opposed to returning a new object with the merged properties and leaving the argument objects unchanged. Confusingly, the function modifies thesource
argument instead of thetarget
. This causes theLocalNotificationsImpl.defaults
object to be modified here. You can workaround this issue by passing these two options with their default values explicitly: