2

I'm working on a cordova application which has a local notification plugin. which I found at this git: https://github.com/katzer/cordova-plugin-local-notifications

I have a problem when I run the click event of a notification. What is happening is the event is being triggered but the parameters notification and status are returning empty.

The notification is triggered and the parameters are correct. the date I used was in the past could it be that?

Does anyone have the same issue and found a solution for it?

cordova.plugins.notification.local.on("click", function (notification, state) {

    if (notification.data == null || notification.data == undefined) { }
    else if (notification.data.localeCompare('') == 0) {
    } else {


    }


}, this);

NotificationTemplate = function (sheduleTime, id, title, text, process,rowId) {
var sound = device.platform == 'Android' ? 'file://sound.mp3' : 'file://beep.caf';

cordova.plugins.notification.local.schedule({
    id: id,
    title: title,
    text: text,
    at: sheduleTime,
    sound: sound,
    data: { RowId: rowId, proc: process }
});

};

Luke Griffiths
  • 119
  • 1
  • 1
  • 12

1 Answers1

2

Check the syntax in your mentioned link. You need to schedule a notification with the required data. The sample demonstrates how to schedule a local notification which repeats every week. The listener will be called when the user has clicked on the local notification.

cordova.plugins.notification.local.schedule({
  id: 1,
  title: "Production Jour fixe",
  text: "Duration 1h",
  firstAt: monday_9_am,
  every: "week",
  sound: "file://sounds/reminder.mp3",
  icon: "http://icons.com/?cal_id=1",
  data: {meetingId:"123#fg8"}
});
cordova.plugins.notification.local.on("click", function (notification) {
  joinMeeting(notification.data.meetingId);
});