Original: Cordova-plugin-local-notifications send Android local message
1.GitHub Source code Address:
Https://github.com/katzer/cordova-plugin-local-notifications
2. Parameter Description:
Https://github.com/katzer/cordova-plugin-local-notifications/wiki/04.-Scheduling
3. Event Description:
Https://github.com/katzer/cordova-plugin-local-notifications/wiki/09.-Events
4. Usage examples:
First, the HTML code:
<ion-pane ng-app= "Notitest" ng-controller= "Notictrl" > <ion-header-bar class= "bar-positive" align-title= " Center > Second, JS code
1. Sending a single message
Cordova.plugins.notification.local.schedule ({ id:1, title: ' App Reminder ', text: ' Apply new message, paragraph see it ', at:new Date (). GetTime (), badge:2});//new version Use Add to replace Schedulecordova.plugins.notification.local.add ( {id:1, Title: ' App Reminder ', text: ' Apply new message, section ', at:new Date (). GetTime (), badge:2, autoclear:true,//default value Sound: ' Res://platform_default ',//default icon: ' Res://ic_popup_reminder ',//default value ongoing:false //default}) ;//Use URI to define icon, sound failed, reason has not found Cordova.plugins.notification.local.add ({ id:1, title: ' App Reminder ~~~1 ', Text: ' Apply new message, watch it ', at:new Date (). GetTime (), badge:2, //using local audio failed sound : ' file:// Permission.mp3 ', //function //icon: ' Ic_media_play ', //using the Ontology picture failed icon: ' File://images/g.jpg ', //Use extranet picture failed //icon: "Http://www.weilanliuxue.cn/Content/Images/Index2/h_index01.jpg",});
2. Send multiple messages
Cordova.plugins.notification.local.schedule ([{ id:1, title: ' App Reminder 1 ', text: ' App reminder content 1 ', at:new Date ()}, { id:2, title: ' App Reminder 2 ', text: ' App reminder content 2 ', //Current time delayed 2 seconds at:new date (new Date (). GetTime () + 1000 * 3)}]);
3. Send duplicate messages
Cordova.plugins.notification.local.schedule ({ title: ' Duplicate Message title ', text: ' Duplicate message content ', at:new Date (), Every: ' Minute '});
4. Sending a message with parameters
Cordova.plugins.notification.local.schedule ({ id:1, title: ' With Parameters ', text: ' content ', firstat:new Date (new Date (). GetTime () + 2 * +), every: ' minute ', data: {meetingid: ' 1324 ', Time:new Date ()}});
5. Event Monitoring
The Shedule event triggers cordova.plugins.notification.local.on at each invocation (' Schedule ', function (notification) { alert (' Scheduled: ' + notification.id);}); /Notification trigger event Cordova.plugins.notification.local.on (' Trigger ', function (notification) { //alert (' triggered: ' + notification.id); Alert (json.stringify (notification)); /Listen for click event Cordova.plugins.notification.local.on (' click ', function (notification) { alert (json.stringify ( notification)); document.getElementById (' title '). InnerHTML = Json.stringify (Notification.data);});
Notification Object Content
Page
Testing the operating system
Cordova-plugin-local-notifications sending Android local messages