0

I found issues from cordova-plugin-local-notification in ionic 5. https://ionicframework.com/docs/native/local-notifications

I want to use multiple notifications in ionic ios

  import { LocalNotifications } from '@ionic-native/local-notifications/ngx';

  ...

  constructor(private localNotifications: LocalNotifications) { }

  sendNoti() {
    let scheduleList = [];
    const currentDate = moment().add(1, 'minutes');
    const currentDate2 = moment().add(2, 'minutes');
    scheduleList.push({
      id: 1,
      text: 'alert',
      foreground: true,
      vibrate: true,
      led: { color: '#FF00FF', on: 500, off: 500 },
    });
    scheduleList.push({
      id: 2,
      text: 'noti 1 min',
      foreground: true,
      vibrate: true,
      trigger: { at: new Date(currentDate.toDate()) },
      led: { color: '#FF00FF', on: 500, off: 500 },
    });
    scheduleList.push({
      id: 3,
      text: 'noti 2 min',
      foreground: true,
      vibrate: true,
      trigger: { at: new Date(currentDate2.toDate()) },
      led: { color: '#FF00FF', on: 500, off: 500 },
    });

    this.localNotifications.requestPermission().then((permission) => {
      this.localNotifications.schedule(scheduleList);
    });
  }

but I receive local notification id 1, I did not receive local notification id 2 and id 3. I found error in output xcode

2021-02-13 16:35:15.446376+0700 MyApp[231:3780] 4
2021-02-13 16:35:15.495124+0700 MyApp[231:4162] [local-notification] Next trigger at: (null)
2021-02-13 16:35:15.525587+0700 MyApp[231:4162] [local-notification] Next trigger at: (null)

my package.json

{
  "name": "moblie_local_notification",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "~10.0.0",
    "@angular/core": "~10.0.0",
    "@angular/forms": "~10.0.0",
    "@angular/platform-browser": "~10.0.0",
    "@angular/platform-browser-dynamic": "~10.0.0",
    "@angular/router": "~10.0.0",
    "@ionic-native/core": "^5.0.0",
    "@ionic-native/local-notifications": "^5.31.1",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.0.0",
    "@ionic/angular": "^5.0.0",
    "cordova-ios": "^5.1.1",
    "cordova-plugin-badge": "^0.8.8",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-local-notification": "^0.9.0-beta.3",
    "firebase": "^7.21.0",
    "moment": "^2.29.1",
    "rxjs": "~6.5.5",
    "tslib": "^2.0.0",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1000.0",
    "@angular/cli": "~10.0.5",
    "@angular/compiler": "~10.0.0",
    "@angular/compiler-cli": "~10.0.0",
    "@angular/language-service": "~10.0.0",
    "@ionic/angular-toolkit": "^2.3.0",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^6.0.0",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^4.2.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~3.3.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~3.9.5"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-local-notification": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
     "cordova-plugin-ionic-keyboard": {}
   },
   "platforms": [
     "ios"
   ]
 }

}

ionic info

Ionic:

Ionic CLI                     : 5.4.16 (/usr/local/lib/node_modules/ionic)
Ionic Framework               : @ionic/angular 5.3.2
@angular-devkit/build-angular : 0.1000.8
@angular-devkit/schematics    : 10.0.8
@angular/cli                  : 10.0.8
@ionic/angular-toolkit        : 2.3.3

Cordova:

Cordova CLI       : 9.0.0 ([email protected])
Cordova Platforms : ios 5.1.1
Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, 
cordova-plugin-ionic-webview 4.2.1, (and 6 other plugins)

Anyone have a solution to fix this issue or not? Or have any suggestion plugin?

3
  • Don't put Images in your Question. Add Code you your question for better Understanding. Check this: stackoverflow.com/help/how-to-ask Commented Feb 12, 2021 at 6:36
  • Sorry for my first post. I already edit my question
    – meawiey
    Commented Feb 13, 2021 at 10:08
  • Did you already solve it? It doesnt work on iOS still... Commented Mar 23, 2021 at 13:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.