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

};

1
  • How is your notification constructed? The code in your question doesn't really tell us much. Commented Apr 21, 2017 at 16:52

1 Answer 1

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);
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.