I can not use cordova plugins


#1

(My English isn’t very good )

Maybe it’s a very simple matter.I’m beginner
I am developing an Online Radio Stream app.I want to use Notifications.


I am applying this.

I add this,
cordova.plugins.notification.local.schedule({
title: ‘Happy Birthday!!!’,
trigger: { every: { month: 10, day: 27, hour: 9, minute: 0 } } . //What matters to me but non-working section on ionic local notifications
});

And I am constantly getting the same error.

underlined cordova

Cannot find name ‘cordova’

WHY? :frowning:

how to use this plugin?


#2

declare let cordova: any;
in your file at first line globally or in constructor

If you are using angular2 or higher

use it like local-notification.


#3

Please try a simple plugin first to see if all works, before trying this one


#4

But it doesn’t allow ‘trigger’ for Schedule Notifications @heenavora


#5

It is work.For example

This works well.

But I want to use trigger.It doesn’t allow.

I also wanted to use the https://github.com/katzer/cordova-plugin-local-notifications

I guess I’m trying to do something stupid, but i don’t know. I need to use trigger :slight_smile:

@Tommertom


#6

may be this will help you.


#7

@Heenavora,

when i write this,
trigger: { every:‘1’, unit:‘minute’}

Error;
Argument of type ‘({ id: number; title: string; text: string; data: { mydata: string; }; at: Date; } | { id: number…’ is not assignable to parameter of type ‘ILocalNotification | ILocalNotification[]’.
Type ‘({ id: number; title: string; text: string; data: { mydata: string; }; at: Date; } | { id: number…’ is not assignable to type ‘ILocalNotification[]’.
Type ‘{ id: number; title: string; text: string; data: { mydata: string; }; at: Date; } | { id: number;…’ is not assignable to type ‘ILocalNotification’.
Type ‘{ id: number; title: string; text: string; data: { mydata: string; }; at: Date; trigger: { every:…’ is not assignable to type ‘ILocalNotification’.