katzer / cordova-plugin-local-notifications

Cordova Local-Notification Plugin
Apache License 2.0
2.56k stars 1.74k forks source link

issue with trigger property of schedule method- not working even app is in foreground(normal schedule working properly) #1914

Open anirudhsanthosh opened 3 years ago

anirudhsanthosh commented 3 years ago

WARNING: IF YOU IGNORE THIS TEMPLATE, WE'LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!

Provide a general summary of the issue. plugin is working fine except the trigger property. i am able to schedule notification and the notifications are showing normally, but in the case of triggered notification it not triggering. we will get the unexecuted notification when using getScheduled() method

Your Environment

-------- for additional info including other plugins i am using i encountered an confliction between plugins in gradle version -------- cordova-android-firebase-gradle-release 4.0.0 "cordova-android-firebase-gradle-release" cordova-android-support-gradle-release 3.0.1 "cordova-android-support-gradle-release" cordova-custom-config 5.1.0 "cordova-custom-config" cordova-plugin-androidx 2.0.0 "cordova-plugin-androidx" cordova-plugin-androidx-adapter 1.1.1 "cordova-plugin-androidx-adapter" cordova-plugin-badge 0.8.8 "Badge" cordova-plugin-device 2.0.3 "Device" cordova-plugin-firebasex 9.1.2-cli "Google Firebase Plugin" cordova-plugin-geolocation 4.0.2 "Geolocation" cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification" cordova-plugin-mock-gps-checker 1.0.0 "MockGpsChecker" cordova-plugin-screen-orientation 3.0.2 "Screen Orientation" cordova-plugin-splashscreen 5.0.3 "Splashscreen" cordova-plugin-whitelist 1.3.4 "Whitelist" cordova-support-google-services 1.3.2 "cordova-support-google-services" cordova.plugins.diagnostic 5.0.2 "Diagnostic" es6-promise-plugin 4.2.2 "Promise" phonegap-plugin-multidex 1.0.0 "Multidex"

Expected Behavior

case 1 the below code should produce a notification at 2020-07-21 15:19:00

cordova.plugins.notification.local.schedule({
    title: 'Design team meeting',
    text: '3:00 - 4:00 PM',
    trigger: { at: new Date(2020, 7, 21, 15,19,0) }
});

case 2 the below code should trigger a notification instantly

cordova.plugins.notification.local.schedule({
    title: 'My first notification',
    text: 'Thats pretty easy...',
    foreground: true
});

Actual Behavior

case 1 no notification triggered

  1. app was running. ( checked in background also)
  2. getScheduled() method shows the un triggered(pending) notification in the log

case 2 a new notification showing instantly

  1. getScheduled() method shows the no notification in the log

Tell us what happens instead

a notification should appear at the triggered time at least while the app is running

Steps to Reproduce

following code produce the error

cordova.plugins.notification.local.schedule({ id:15, title: "Sale Report Reminder", text: "Please send sale report before 8.05 PM.", trigger: { at: today }, })

------ i checked all the triggering object mentioned in the api shows same issue --------

Reproduce this issue; include code to reproduce, if relevant

if (cordova.plugins.notification.local) {
    const today = new Date();
    for (let i = 0; i < 10; i++) {
      const id = i; 
      today.setMinutes(today.getMinutes() + i);
        cordova.plugins.notification.local.schedule({
          id,
          title: "Sale Report Reminder",
          text: "Please send sale report before 8.05 PM.",
          trigger: { at: today },
        });
    }
  }

Context

What were you trying to do?

i was trying to trigger a notification in future time.

Debug logs

Include iOS / Android logs

xangadix commented 3 years ago

were you even able to fix this? I seem to have the same problem