Cordova-plugin-local-notifications: Repeat every day on the given time

Created on 22 May 2020  路  7Comments  路  Source: katzer/cordova-plugin-local-notifications

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

Provide a general summary of the issue.
The notification shows once I install the app but then on a swipe of notification it appears again also app won't open on tap and then after a minute it crashes.

Your Environment

  • Plugin version: "cordova-plugin-local-notification": "^0.9.0-beta.2",
  • Platform: android
  • OS version: Ubuntu 18.10
  • Device manufacturer / model: Issue occurs in all device
  • Cordova version (cordova -v): 9.0.0
  • Cordova platform version (cordova platform ls): android 8.1.0
  • Plugin config
  • Ionic Version (if using Ionic) Not ionic

Expected Behavior

_Tell us what should happen_
After installing the app, Array of given notification should appear every day at a given time. I should be able to remove the notification on swipe and should also be able to open the app on tap of the notification.

Actual Behavior

The notification doesn't go when I clear the notification panel. My app doesn't open on tap. App crashes after a minute.

Steps to Reproduce

_Reproduce this issue; include code to reproduce, if relevant_

  1. on cordova "deviceready" add the following code.
onDeviceReady() {
      // Now safe to use device APIs
      if (window.cordova) {
        alert("device ready");
        let cordovaPlugin = cordova.plugins;
        cordovaPlugin.notification.local.schedule([
          {
            id: 0,
            title: "Remind",
            text: "Remind me to drink water.",
            trigger: {
              every: {
                hour: 17,
                minute: 36
              }
            }
          },
          {
            id: 1,
            title: "Remind",
            text: "Buy Milk",
            trigger: {
              every: {
                hour: 17,
                minute: 34
              }
            }
          }
        ]);
      }
    }
  1. Create and install the cordova "app-debug.apk" on any android phone.
  2. open the app and initiate the plugin and wait for the given time.
  3. notification appears on a given time but you can neither get rid of notification nor able to open the app. After a minute app will crash and notification will go away.

Context

I am trying to create a reminder for everyday but different timings.
eg:

  1. Remind me to drink water everyday at morning 8 AM.
  2. Remind me to watch the movie every day at 9 PM.

Debug logs

no issue on logs compiles successfully.

_Include iOS / Android logs_
No error logs observed.

  • ios XCode logs
  • Android: $ adb logcat

Most helpful comment

hi all, perhaps you can try this fork, it is more recent and still maintained:
https://github.com/timkellypa/cordova-plugin-local-notifications

hope it helps. thanks.

All 7 comments

Yeah, I had the same issue and opened it a couple of months ago and I never received any answers.

Yeah, I had the same issue and opened it a couple of months ago and I never received any answers.

Yeah I guess the project is not maintained anymore. Are you aware of any other similar cordova plugin.

Faced the same problem.
I found out that the notification is not hiding because it is not one notification, but infinity. Until the minute runs out, notifications appear again if you hide them.
A possible solution is to specify not only minutes, but also seconds in the every parameter. Crutch, but it seems to work.
Found this issue after switching from 3 ionic to 5

Specifying seconds in every didn't help. But I noticed that the notification is forcibly displayed for a minute, and then disappears automatically.
That is, the behavior of the notification is completely inconsistent with the old behavior. It is not known what the matter is, in the plugin, or in the android, we need to look for workarounds

hi all, perhaps you can try this fork, it is more recent and still maintained:
https://github.com/timkellypa/cordova-plugin-local-notifications

hope it helps. thanks.

Guys, I sat all day and came to the following conclusion.
Cordova notifications work so-so and for reliability it is better to use the most typical simple designs.
In my case, notifications need to be sent daily at 21:00. "Trigger every" does not work. It worked for me for ionic 3, but after switching to ionic 5 it began to get stuck like yours.

Solution: in a loop, create several "trigger at" notifications for the required dates, instead of one with "trigger every".
For me, it's enough to create notifications 10 days in advance and update these notifications every time the application is launched. To update, it is enough with these 10 notifications to put down the same ID every time.

But for some reason, even ordinary notifications are not shown every time. I don't know what to do, probably let it be as it is.
UPDATE: This xiaomi blocks simple notifications, everything is working

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Shashank2406 picture Shashank2406  路  5Comments

Kasendwa picture Kasendwa  路  3Comments

bhumin3i picture bhumin3i  路  5Comments

AbayIbrayev picture AbayIbrayev  路  4Comments

GitToTheHub picture GitToTheHub  路  4Comments