katzer / cordova-plugin-local-notifications

Cordova Local-Notification Plugin
Apache License 2.0
2.57k stars 1.75k forks source link

getAllTriggered not working on Android #1837

Closed elnezah closed 2 weeks ago

elnezah commented 5 years ago

When calling getAllTriggered, plugin only throws a warning saying that the cordova plugin is not installed (it obviously is installed and working fine apart of this very issue).

Console output: Native: tried calling LocalNotifications.getAllTriggered, but the LocalNotifications plugin is not installed. My code: console.log('All triggered', this.localNotifications.getAllTriggered()); (object this.localNotifications is got as parameter in the constructor and is an instance of LocalNotifications).

My Environment

Expected Behavior

I expected to get all triggered notifications on the console.

Actual Behavior

I get a warning in the console and it seems that the plugin is not recognized by this function.

Steps to Reproduce

Just install the plugin, set one notification, wait until it triggers (so you know it works) and then call the method getAllTriggered().

Context

Get all the Id's in order to be able to deactivate all repeating alarms "in case of fire"

Debug logs

Include iOS / Android logs

  pluginWarn @ vendor.js:76763
  checkAvailability @ vendor.js:76645
  callCordovaPlugin @ vendor.js:76728
  (anonymous) @ vendor.js:76546
  (anonymous) @ vendor.js:76504
  ZoneAwarePromise @ polyfills.js:3272
  tryNativePromise @ vendor.js:76503
  getPromise @ vendor.js:76524
  wrapPromise @ vendor.js:76529
  (anonymous) @ vendor.js:76823
  cordova @ vendor.js:77042
  push../node_modules/@ionic-native/local-notifications/ngx/index.js.LocalNotifications.getAllTriggered @ vendor.js:78429
  push../src/app/pages/medication/alarms/alarms.page.ts.AlarmsPage.getAllTriggered @ medication-alarms-alarms-module.js:294
  eval @ AlarmsPage.html:119
  handleEvent @ vendor.js:59230
  callWithDebugContext @ vendor.js:60300
  debugHandleEvent @ vendor.js:60027
  dispatchEvent @ vendor.js:56679
  (anonymous) @ vendor.js:57126
  (anonymous) @ vendor.js:68989
  push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ polyfills.js:2785
  onInvokeTask @ vendor.js:53413
  push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ polyfills.js:2784
  push../node_modules/zone.js/dist/zone.js.Zone.runTask @ polyfills.js:2557
  push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask @ polyfills.js:2860
  invokeTask @ polyfills.js:4106
  globalZoneAwareCallback @ polyfills.js:4143
katzer commented 5 years ago

That must be an issue with Ionic. Without Ionic it works for me.