[Local Notifications Plugin] No enum constant de.appplant.cordova.plugin.notification.trigger.DateTrigger.Unit.0
Forge component by OutSystems R&D
Application Type
Mobile
Service Studio Version
11.10.4 (Build 36716)

Hi, I'm trying to build a mobile app, that schedules local notifications. 

The problem is, that the app crashes (ends without a notice) as soon as I trigger the ScheduleNotifications Client Action.

Cordova and the LocalNotificationsPlugin return true for loaded and ready.

The dev monitor displays the following error for the crashes:

A fatal error has occurred. Please contact OutSystems support: No enum constant de.appplant.cordova.plugin.notification.trigger.DateTrigger.Unit.0 

The stack is:

java.lang.IllegalArgumentException: No enum constant de.appplant.cordova.plugin.notification.trigger.DateTrigger.Unit.0
at java.lang.Enum.valueOf(Enum.java:257)
at de.appplant.cordova.plugin.notification.trigger.DateTrigger$Unit.valueOf(DateTrigger.java:30)
at de.appplant.cordova.plugin.notification.Request.getUnit(Request.java:198)
at de.appplant.cordova.plugin.notification.Request.buildTrigger(Request.java:178)
at de.appplant.cordova.plugin.notification.Request.<init>(Request.java:75)
at de.appplant.cordova.plugin.localnotification.LocalNotification.schedule(LocalNotification.java:270)
at de.appplant.cordova.plugin.localnotification.LocalNotification.access$400(LocalNotification.java:62)
at de.appplant.cordova.plugin.localnotification.LocalNotification$1.run(LocalNotification.java:146)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:929)


I tried to republish and reinstall the App, but the problem remains.

I also tried to manually upgrade to Plugin Version 7.0.1 (including republish, rebuild APK, and reinstall App), but same error.

The data I submit with ScheduleNotification:

id: 1 (also tried other numbers, 0 and empty)
title: "Test1"
text: "Test2"
every: 0
at: CurrDateTime() (also tried empty, other dates and times)
badge: 0 (also tried other numbers)
sound: empty
data: empty

The mobile device I'm testing on: Huawei P30 Pro, Android Version 10, all updated

What am I doing wrong?

Thank you very much for any help or advice!


Best regards

Chris

mvp_badge
MVP

Hi Chris,

When you post a question on the forum you can also select the Forge component to which your question relates. This will help community members to understand your question better, resulting in more replies.

So maybe you can edit your post, or if that is not possible I can do it for you, but you will have to tell me which Forge component you use? Is it the Local Notification Plugin?

Regards,

Daniel

Hi Daniel,

I thought I had this information covered since it was shown when I created the post.

I can't seem to edit it now. Yes, it's the Local Notification Plugin. Thank you very much for your help :)

Best regards

Chris

Is there anybody who might have an answer to that??

I'm really getting desperate :D

I have exactly the same problem. 

Hi Sandra,

on which device are you testing?

I just want to find out, if it's a Huawei or specific device type issue.

Thank you!

Best regards

Chris

Hi Chris,

It's Samsung Galaxy 8. I tried it on multiple other devices, got same problem. Doubt it's device related 

Hi all,

I also had this issue after upgrading this plugin to the new version.

This issue was happening because the input "every" had an invalid value.
I was not setting this input but the value send was "0".
As you can see, this is the default value.


On the old version, this was working because the JSON Serialize on the "ScheduleNotifications" action was set to not serialize default values.
This is the new version: is set to serialize default values.

This input should be set with one of these options: SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR 

In my case, I'm not using the input "every", I'm only using the input "at".

Because of that, I changed the plugin to not serialize default values, avoiding sending invalid values.


I'm not sure if this is the correct thing to do, but I believe that the plugin should be updated to raise an error if one of this input ("at", "every") are not filled. Returning the error to the main app, avoiding the application crash, and also do not serialize default values.


Hello OutSystems community!

We have identified what the problem is, and will release a new version of the Local Notifications Plugin as soon as possible. In the meantime, as a workaround, the "every" parameter should not be left empty. Instead, use a value like "" (empty string). When the new version of the plugin is released the "every" parameter can be left empty again, using the default value.

Best regards,

Alexandre

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.