Local Notification trigger not working in 0.9.0_beta.3
See original GitHub issueWARNING: 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
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top GitHub Comments
@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
NOTE:
cordova.plugins.notification
had to changed tocordova.plugins['notification']
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({ … });