question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documentation for repeating notification is misleading

See original GitHub issue

Your Environment

  • Plugin version: 0.9.0-beta.1
  • Platform: Android
  • OS version: 6.0.1
  • Device manufacturer / model: Motorola Moto X Play
  • Cordova version (cordova -v): 7.1.0
  • Cordova platform version (cordova platform ls): 6.3.0
  • Plugin config: default
  • Ionic Version (if using Ionic): 3.19.0

Expected Behavior

A notification should appear every 3 minutes.

Actual Behavior

A notification appear after 3 minutes, I manually remove it from the notification bar, and no other notification appear after more 3 minutes.

Steps to Reproduce

  1. Schedule a notification with this code: cordova.plugins.notification.local.schedule({ id: 10, icon: 'file://assets/imgs/logo.png', title: 'Test Title', text: 'Test description', trigger: { unit: 'minute', every: 3 } });
  2. Wait 3 minutes
  3. Remove notification manually
  4. Wait another 3 minutes
  5. Nothing happens

Context

I was trying to make some kind of an alarm, customized by the user. I think my problem is the repeat structute on the options object. Documentation is misleading. Here (https://github.com/katzer/cordova-plugin-local-notifications#properties-2) it says to use “every” and “count” inside a “trigger” property. I don’t know what count does, too. Here (https://github.com/katzer/cordova-plugin-local-notifications/wiki/04.-Scheduling#interface) it says to use every, without trigger object. In a closed issue I found this “trigger: { any: ‘minute’, every: 3 }” and thought it was right, but looks like it doesn’t work too.

What is the correct way to repeat an notification? Documentation should be consistent.

Debug logs

Couldn’t filter logs.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
brunnohofmanncommented, Dec 1, 2017

Check the Background Mode plugin (from Katzer too). Then mix with the Local Notification plugin.

this.repeticaoAgua = setInterval(function(){ this.localNotifications.schedule({ id: 1, icon: 'res/iconred.png', title: 'Hora de tomar água!' }); }.bind(this), (60000));

I putted the interval on a var to cancel it if when I want

cancelAguaNotification(){ clearInterval(this.repeticaoAgua); }

0reactions
katzercommented, Jan 6, 2018

I tried with master using Android Emulator and Samsung and it worked as expected. Even I clear the notification it pops-up again after.

The relevant entry point in the code is here: https://github.com/katzer/cordova-plugin-local-notifications/blob/0.9.0-beta.1/src/android/ClearReceiver.java#L49

Read more comments on GitHub >

github_iconTop Results From Across the Web

repeats | Apple Developer Documentation
A Boolean value indicating whether the system reschedules the notification after it's delivered.
Read more >
Repeating notifications issue - android - Stack Overflow
It is obvious why your notifications appear immediately. In AlarmReceiver you do this: val calendar = Calendar.
Read more >
Unity Mobile Notifications Package | 1.0.4-preview.9
These can be used to schedule and manage notifications for their respective platforms. You can download a sample Project which implements a high-level ......
Read more >
Repeating notifications on android app - Configuration
Hi, I'm trying to get 'rich', repeating notifications on Android when my smoke sensor detects fire. Using the notifications service in ...
Read more >
Scheduling notifications: UNUserNotificationCenter and ...
containing a message if something went wrong. All this functionality is contained in the UserNotifications framework, so before continuing add this import line ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found