1. add plugin Local-Notification
cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications
2. To test a sample, In onDeviceReady, add below. This will show the notification after about a minute after you launch your app. You can close the app or minimize it (ie; go launch another app or go to home page)
var date = new Date();
date = new Date(date.getTime() + 1 * 60000) // add a minute from now
cordova.plugins.notification.local.schedule({
id: 1,
title: "My Notification Title",
message: "My Notification Body",
at: date,
sound: "res://platform_default"
});
No comments:
Post a Comment