Reputation: 1
Hello. Sorry for the poor translation.
I am developing an application using Cordova and am using the "cordova-plugin-local-notifications" plugin to implement local notifications.
Currently, I am outputting local notifications 10 seconds after the application is moved to the background, and I have written the following
cordova.plugins.notification.local.schedule({
id: 1,
title: "Test",
text: "Test Message.",
trigger: {unit:"second", in:10}
});
If we implement this process, local notifications will be output even after the application is closed.
How can I prevent local notifications from being output after the application is closed?
Upvotes: 0
Views: 305
Reputation: 10626
You need to clear the pending notifications when the user closes the app, try
window.addEventListener('beforeunload', function(event) {
cordova.plugins.notification.local.clear();
});
I'm not certain it's clear
or clearAll
Upvotes: 0