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.

Local Notification trigger not working in 0.9.0_beta.3

See original GitHub issue

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

Provide a general summary of the issue. Initializing an array called notification with parameter below: let hr = 10; let mn = 30; let notification = { id: alarmId, title: AlarmTitle, text: AlarmText, trigger: { every: { hour: hr, minute: mn} } }; this.localNotifications.schedule(notification);

Error is coming : [ts] Argument of type ‘{ id: any; title: any; text: any; trigger: { every: { hour: string; minute: any; }; }; }’ is not assignable to parameter of type ‘ILocalNotification | ILocalNotification[]’. Type ‘{ id: any; title: any; text: any; trigger: { every: { hour: string; minute: any; }; }; }’ is not assignable to type ‘ILocalNotification[]’. Property ‘length’ is missing in type ‘{ id: any; title: any; text: any; trigger: { every: { hour: string; minute: any; }; }; }’.

Your Environment

  • Plugin version: 0.9.0_beta.3
  • Platform: android
  • OS version: oreo (8.0.0)
  • Device manufacturer / model: Mi A1
  • Cordova version (cordova -v): 7.1.0
  • Cordova platform version (cordova platform ls): -> Installed platforms: -> android 6.3.0
  • Available platforms: -> blackberry10 ~3.8.0 (deprecated) -> browser ~5.0.0 -> ios ~4.5.1 -> osx ~4.0.1 -> ubuntu ~4.3.4 (deprecated) -> webos ~3.7.0 -> windows ~5.0.0 -> www ^3.12.0
  • Plugin config:

cordova plugin ls -> com-badrit-base64 0.2.0 “Base64” -> cordova-android-support-gradle-release 1.3.0 “cordova-android-support-gradle-release” -> cordova-base64-to-gallery 4.1.3 “base64ToGallery” -> cordova-plugin-android-permissions 1.0.0 “Permissions” -> cordova-plugin-badge 0.8.7 “Badge” -> cordova-plugin-calendar 5.0.0 “Calendar” -> cordova-plugin-camera 4.0.4-dev “Camera” -> cordova-plugin-device 1.1.4 “Device” -> cordova-plugin-facebook4 1.9.1 “Facebook Connect” -> cordova-plugin-file 5.0.0 “File” -> cordova-plugin-file-transfer 1.7.0 “File Transfer” -> cordova-plugin-firebase 1.0.0 “Google Firebase Plugin” -> cordova-plugin-geolocation 4.0.1 “Geolocation” -> cordova-plugin-googleplus 5.1.1 “Google SignIn” -> cordova-plugin-ionic-webview 1.1.16 “cordova-plugin-ionic-webview” -> cordova-plugin-local-notification 0.9.0-beta.3 “LocalNotification” -> cordova-plugin-sim 1.3.3 “SIM” -> cordova-plugin-speechrecognition 1.1.2 “Speech Recognition” -> cordova-plugin-splashscreen 4.0.3 “Splashscreen” -> cordova-plugin-whitelist 1.3.1 “Whitelist” -> cordova-plugin-x-socialsharing 5.2.1 “SocialSharing” -> cordova-plugin-youtube-video-player 1.0.6 “CordovaYoutubeVideoPlayer” -> cordova-sms-plugin 0.1.11 “Cordova SMS Plugin” -> cordova-sqlite-storage 2.1.2 “Cordova sqlite storage plugin” -> cordova-wheel-selector-plugin 1.0.0 “Cordova Wheel Selector Plugin” -> es6-promise-plugin 4.1.0 “Promise” -> ionic-plugin-keyboard 2.2.1 “Keyboard” -> phonegap-plugin-barcodescanner 7.0.2 “BarcodeScanner”

  • Ionic Version (if using Ionic) -> @ionic/cli-utils : 1.19.0 -> ionic (Ionic CLI) : 3.19.0

Expected Behavior

trigger parameter for scheduling notification is not working at all. Tell us what should happen

  • Previously i was using local notification 0.8.5 after upgrading my android sdk 0,8.5 is not working, so i have upgraded local notification from 0.8.5 to 0.9.0_beta.3 and now trigger is not working, actions is working fine.

What were you trying to do?

I wanted to set the notification at specific time but after setting up time from time picker , notification comes instantly when i use action parameter but for trigger i am getting error

aaalrm

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

4reactions
sameera207commented, Feb 8, 2019

@bilelmoulahi 's answer got me to get the code working again. However, I had to slightly change the code due to typescript errors. So, my working version looks like

cordova.plugins['notification'].local.schedule({
      text: 'Test notifucation',
      trigger: {in: 2, unit: 'hour'},
    });

NOTE: cordova.plugins.notification had to changed to cordova.plugins['notification']

Ionic:

   ionic (Ionic CLI)             : 4.10.2 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.1
   @angular-devkit/build-angular : 0.12.4
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.2.4
   @ionic/angular-toolkit        : 1.3.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 6 other plugins)

System:

   ios-deploy : 1.9.4
   ios-sim    : 7.0.0
   NodeJS     : v8.10.0 (/usr/local/bin/node)
   npm        : 6.5.0
   OS         : macOS Mojave
   Xcode      : Xcode 10.1 Build version 10B61
3reactions
bilelmoulahicommented, May 23, 2018

The plugin version you are using is not compatible yet with Ionic Native (see Readme file). The ionic wrapper is not part of this plugin. So you should schedule your notification the way it is indicated in the readme file. Instead of using : this.localnotifications.schedule({…}) try : cordova.plugins.notification.local.schedule({ … });

Read more comments on GitHub >

github_iconTop Results From Across the Web

cordova-plugin-local-notification trigger at did not work in IOS
I found issues from cordova-plugin-local-notification in ionic 5. ... "cordova-plugin-local-notification": "^0.9.0-beta.3", ...
Read more >
Current working version of Local Notification - Ionic Native
cordova-plugin-local-notification - ~0.9.0-beta.2 @ionic-native/local-notifications ... This was working for me before and is not now.
Read more >
Ionic Localnotifications With Capacitor: Cannot Find ... - ADocLib
Issue description : You've added notifications well but the problem is ... Plugin version: 0.9.0beta.3; Platform: Android; Cordova version cordova v : 9.0.0 ......
Read more >
Scheduling and Handling Local Notifications - Apple Developer
If your app is not running, or if it is in the background, the system displays ... Listing 3-1Creating and configuring a local...
Read more >
SerproLivre/cordova-plugin-local-notifications - JitPack
Further development for v0.9-beta will happen here. The 0.9-dev and ios10 branches are obsolate and will be removed soon. Known issues.
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