cordova本地通知出错

Error in cordova local notification

我在我的项目中添加了 Cordova-plugin-local-notification(https://github.com/katzer/cordova-plugin-local-notifications)。 我将此代码添加到项目

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

但显示错误:

cordova is not defined
    at new MyApp

我该如何解决这个问题? 请帮忙

需要,像这样声明cordova,

declare var cordova: any;