Cordova app crashed when local notification tried to occurs and app shows "open app again"

Viewed 143

I am working on ionic 6, angular 10 and node 12. I am using cordova to deploy app and test local notification. I am trying to show local notification on click event but app crashed and show "charity app has stopped, open app again".

enter image description here

I tried fix it by removing the node_module, platform, plugins folder, config.xml file and install npm again and deploy app again but it still showing again. In my config file I am using <plugin name="cordova-plugin-local-notification" spec="^5.28.0" />. In package.json file dependency is "@ionic-native/local-notifications": "^5.28.0", and devDepency is "cordova-plugin-local-notification": "^0.9.0-beta.2", and plugin is "cordova-plugin-local-notification": {}

I add also it in the app.module.ts file by using import { LocalNotifications } from '@ionic-native/local-notifications/ngx'; this import. and in providers LocalNotifications,.

in notification.page.ts I import it by import { LocalNotifications } from '@ionic-native/local-notifications/ngx'; and constructor injection private localNotifications: LocalNotifications.

Here Is code where I am showing local notification:

manageNotification() {
    this.localNotifications.schedule({
      title: 'title of notification',
      text: 'details of notification goes here.'
    });
  }

Please help me How can I resolve it. If you require missing details please ask in comment.

0 Answers
Related