WARNING: IF YOU IGNORE THIS TEMPLATE, WE'LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!
Provide a general summary of the issue.
cordova -v): 7.1.0cordova platform ls): Android 6.4.0I wanna receive repeating notifications with my ionic app, passing a value in minutes
Nothing happens
_Reproduce this issue; include code to reproduce, if relevant_
First of all... I wanna do a repeating notification.
Ive read the entire documentation, but when I wanna put the "trigger" option on the schedule function I receive the following error:
"Argument of type '{ id: number; icon: string; title: string; trigger: { every: string; count: number; }; }' is not assignable to parameter of type 'ILocalNotification | ILocalNotification[]'.
Object literal may only specify known properties, and 'trigger' does not exist in type 'ILocalNotification | ILocalNotification[]'."
Searching the files I found this interface "ILocalNotification" who make part of the native local notification and really, it doesnt have this argument.
I tried to reinstall the plugin but nothing happens too.
I dont know if its diferent (the native one, imported with @ionic-native/local-notifications) from the Katzer plugin.
If i change the "trigger" option with "every: 'minute'", I only receive one notification too.
_Include iOS / Android logs_
I am getting the same error, using ionic and iOS.
I didn't could find one solution too... :(
Em 13 de dez de 2017 10:55, Noé Bezerra notifications@github.com escreveu:
Same problem, does anyone have a solution?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/katzer/cordova-plugin-local-notifications/issues/1446#issuecomment-351397467, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE7hDLc7ArD_7vi_TAWmtxXzop4TtMl_ks5s_9c5gaJpZM4QvydG.
I believe the issue is because the ionic-native version of this plugin has not been updated. The ionic docs show "ILocalNotification" params to include stuff like "at", "every", and "firstAt". These params also show up in the plugin as downloaded through ionic-native. But stuff like "at", "every", and "firstAt" have been removed from the plugin in the latest version of the plugin itself.
However, building the app with ionic for a device does not recognize these params. So the app is not able to use stuff like "at" (old version) or "trigger" (new version).
Solution would be for the ionic native version to be updated to latest version of the plugin?
I have found a solution that seems to work at least for now: use the cordova plugin directly (in the ionic project), instead of the ionic native version, which is not updated. It would still be nice for the ionic native version to be updated, but the below seems to work for now.
Some tips on how to use the cordova plugin instead of the ionic native version are here:
1) https://forum.ionicframework.com/t/how-to-use-non-native-plugins-on-ionic/63936/17
2) https://stackoverflow.com/questions/44477597/using-cordova-plugin-with-ionic-not-ionic-native
3) https://stackoverflow.com/questions/42261133/use-plugins-non-ionic-native-in-ionic-2?rq=1
The following steps allowed me to have the cordova plugin version work in the ionic app. Note, it would work in the emulator and on device, but in the browser it would show an error: "cordova is not defined".
Steps I used:
[download the plugin in the normal ionic way]:
$ ionic cordova plugin add cordova-plugin-local-notification
$ npm install --save @ionic-native/local-notifications
[Then, in relevant component ts file]:
import... [whatever your normal imports]
declare var cordova;
...
@Component({...
export class [your export class] {
...
cordova.plugins.notification.local.schedule({
title: 'Amazing Notification',
text: 'Hopefully this works!',
trigger: { in: 1, unit: 'minute' },
});
worked with me....
this.localNotifications.schedule({
id: 1,
title: 'test',
icon: 'file://assets/img/logo.png',
text: 'test',
at: new Date(date.getFullYear(), date.getMonth(), 15, 14, 25, 0)
})
@NL33 cooooool... thanks.. I'll try it!
This is because of Ionic - their wrapper isn't compatible yet with v0.9
Unfortunately the @NL33 solution did not work for me :(
The strange thing is that my application does not return any errors...
Sorry for up but @NL33 you saved my day!
I was stuck during many days, and now, it work!
Tested on Android 8.0
I used ionic with cordova
Next, i follow instructions of @NL33 and it work!
Most helpful comment
I have found a solution that seems to work at least for now: use the cordova plugin directly (in the ionic project), instead of the ionic native version, which is not updated. It would still be nice for the ionic native version to be updated, but the below seems to work for now.
Some tips on how to use the cordova plugin instead of the ionic native version are here:
1) https://forum.ionicframework.com/t/how-to-use-non-native-plugins-on-ionic/63936/17
2) https://stackoverflow.com/questions/44477597/using-cordova-plugin-with-ionic-not-ionic-native
3) https://stackoverflow.com/questions/42261133/use-plugins-non-ionic-native-in-ionic-2?rq=1
The following steps allowed me to have the cordova plugin version work in the ionic app. Note, it would work in the emulator and on device, but in the browser it would show an error: "cordova is not defined".
Steps I used:
[download the plugin in the normal ionic way]:
[Then, in relevant component ts file]:
import... [whatever your normal imports]
declare var cordova;
...
@Component({...
export class [your export class] {
...
cordova.plugins.notification.local.schedule({
title: 'Amazing Notification',
text: 'Hopefully this works!',
trigger: { in: 1, unit: 'minute' },
});