Search code examples
ionic-frameworkionic3localnotification

Error in cordova local notification


I added Cordova-plugin-local-notification on my project(https://github.com/katzer/cordova-plugin-local-notifications). and I added this code to the project

cordova.plugins.notification.local.schedule({
    title: 'My first notification',
    text: 'Thats pretty easy...',
    foreground: true
});

but it shows an error:

cordova is not defined
    at new MyApp

how can I fix this issue? pls help


Solution

  • Need to, declare cordova like this,

    declare var cordova: any;