phonegap plugin add de.appplant.cordova.plugin.local-notification
phonegap run iOS
Code in index.js:
document.addEventListener('deviceready', function () {
try {
cordova.plugins.notification.local.schedule({
text: "This is the text.",
at: new Date(new Date().getTime() + 10000)
});
} catch (e) {
alert("Fail " + e);
}
});
Any suggestion as to what I'm doing wrong?
I tried the same code and it runs on the simulator.
I think you may be forgetting that notifications will not show if you are inside the app. Make sure you go back to the home screen once the app launches (using the shortcut cmd+shift+h), so that the app is in the background when the scheduled time comes (10 seconds) and the notification should show.
You may want to keep the app in the foreground at the first run so that ios will prompt you to allow notifications. After that, restart the app and send it to background.