#Issued to trigger a notification in past. This may not get triggered! warnings when using calendar

1 messages · Page 1 of 1 (latest)

upbeat garden
#

for some reason i get that warning, also here is the trigger json in debug log

#

currently using 2.7.2

#

the warning itself

#

also i have decompiled the part that issues the warning

#

looks like the warning is always issued if you do not set it on repeat, which is the case

#

also for some reason on my xiaomi phone with MIUI optimizations disabled timing is absolutely off

#

when things scheduled at 10PM get triggered at 11 am and in pairs of 2

#

i checked on other phones the timing seems to be ok

raven hornet
#

Yes. We stopped triggering past timestamp notifications as they are not supposed to get triggered as the time passed by.

Can you please share more details on the issue you are facing?

upbeat garden
# raven hornet Yes. We stopped triggering past timestamp notifications as they are not supposed...

sure, one problem is that if repeat is false
then regardless of the value of calendar - system < 0
the expression (calendar - system) < 0 && false is always false

the other is that i changed a non standard setting and now timing is off on the whole system
the screenshot bellow is from build
https://cdn.discordapp.com/attachments/511230996323237899/1264575538287349820/1721568693461.jpg?ex=669e5f3f&is=669d0dbf&hm=5abd1e4586eb12f4c3ae80b359edd23ff06eb54ae819a447b3283fccd7a59bb0&

#

these notifications were scheduled to occur on 22:00 thursday and friday 09:05, but they occured on friday 11:39

i believe it's happening because MIUI hates when that setting is disabled

#

but i had to disable it else it obfuscates installation errors, thankfully i haven't met them in a while

#

so to update the situation: we are adding more test devices to check time correctness

#

currently we are using interval without repeat, no calendar

#

if we confirm that is only that specific xiaomi issue we can just relax

upbeat garden
#

it probably should be

if ((l = calendar.getTimeInMillis()) - System.currentTimeMillis() < 0L || this.repeat)

raven hornet
#

I don't see that code. May be there is a fix post that. Let me check once.

#

You are right about the warning. It was removed already from our code.
But it wasn't backported from v3 as there were many other things to change.

raven hornet
#

If its not a repeat notification and l > 0 or l < 0, it goes to the alarm scheduler. Over there we check the below case

            //If the fire time and current time are far by 1/10 th of a second, we can ignore as this will be past date notifications.
            if (fireDate.getTime() - currentDate.getTime() < -100)
            {
                System.out.println("Ignoring this notification as its for a past date");

                if(listener != null) {
                    listener.onFailure("Can't trigger past timestamp notifications. Ignoring this notification.");
                }
                return;
            }
#

So the code you have should work the same way but just that warning will be printed.

I didn't get the other issue you mentioned. Can you please let me know once?

pulsar linden
#

Hi @raven hornet , I don't know if this is related, but when I create a notification with
NotificationBuilder.SetCalendarNotificationTrigger(DateComponents, Boolean)
I've some trouble converting my DateTime to this DateComponents you use. The month is converted differently on android and ios, so i'm forced to do this:

  {
    DateComponents dateComponents = new DateComponents();
    dateComponents.Year = dateTime.Year;
#if UNITY_IOS
    dateComponents.Month = dateTime.Month;
#endif
#if UNITY_ANDROID
    dateComponents.Month = dateTime.Month - 1;
#endif
    dateComponents.Day = dateTime.Day;
    dateComponents.Hour = dateTime.Hour;
    dateComponents.Minute = dateTime.Minute;
    dateComponents.Second = dateTime.Second;
    
    return dateComponents;
  }```

I'm using the plugin v2.7.4 with unity 2022.3.50f1.

Is this something you are aware of?