question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trigger argument doesnt recognized

See original GitHub issue

WARNING: IF YOU IGNORE THIS TEMPLATE, WE’LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!

Provide a general summary of the issue.

Your Environment

  • Plugin version: 0.9.0-beta.1
  • Platform:Android
  • OS version: ^6.4.0
  • Device manufacturer / model:
  • Cordova version (cordova -v): 7.1.0
  • Cordova platform version (cordova platform ls): Android 6.4.0
  • Plugin config
  • Ionic Version (if using Ionic): 3.19.0

Expected Behavior

I wanna receive repeating notifications with my ionic app, passing a value in minutes

Actual Behavior

Nothing happens

Steps to Reproduce

Reproduce this issue; include code to reproduce, if relevant

  1. Import a Local Notification on a Ionic Page “import { LocalNotifications } from ‘@ionic-native/local-notifications’;”
  2. Put o construct: private localNotifications: LocalNotifications,
  3. Schedule a new notification with this code: as related on documentation this.localNotifications.schedule({ id: 1, icon: ‘res/iconred.png’, title: ‘Hora de tomar água!’, trigger: {every: ‘day’, count: 300} });
  4. The code doest work

Context

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.

Debug logs

Include iOS / Android logs

  • ios XCode logs
  • Android: $ adb logcat

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
NL33commented, Dec 18, 2017

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’ }, });

2reactions
NL33commented, Dec 15, 2017

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Function that is called inside the trigger is not recognized
I am trying to create my first trigger in postgres but I keep receiving this: [42883] ERROR: function clear_article_flag does not exist.
Read more >
IMessageSession parameter not recognized in Azure Function ...
I have this function [FunctionName("MyFunction")] public static async Task Run([ServiceBusTrigger("myqueue", Connection = "MyBusConnString", ...
Read more >
Troubleshoot issues when using Azure Functions trigger for ...
Common issues, workarounds, and diagnostic steps, when using the Azure Functions trigger for Azure Cosmos DB.
Read more >
Parameters with Alexa not working | TRIGGERcmd Forum
I can't pass parameters with Alexa (in Portuguese) using the Skill "TRIGGERcmd Smart Home". If I use the Skill "Execute comando", ...
Read more >
.trigger() | jQuery API Documentation
An array of arguments can also be passed to the .trigger() call, ... Note: When triggering with a plain object that is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found