我正在使用本地通知插件 https://github.com/katzer/cordova-plugin-local-notifications.git 当通知在起始页面时,当我从主页面导航到另一个页面时,新页面中的通知不起作用我尝试将第二页作为起始页面并且通知工作正常好的
以下是从Web服务获取日期的通知代码
$.ajax({
url: "mywebservicelink",
data: {
Name: name,
Gender: gender,
BirthDate: birthdate,
BirthHour: birthhour,
BirthPlace: birthplace,
DoctorName: doctorname,
disease: disease,
allergy: allergies,
OtherMedicalCondititon: others,
PID: MumId,
img: img
},
type: "POST",
dataType: "xml",
success: function(response) {
$(response).find("childvacineinfo").each(function(index) {
var Vaccinedate = $(this).find("VaccineDate").text();
y = parseInt(Vaccinedate.substring(0, 4));
m = parseInt(Vaccinedate.substring(5, 7));
d = parseInt(Vaccinedate.substring(8, 10));
u = parseInt(Vaccinedate.substring(14, 16));
da = Vaccinedate.substring(0, 10);
dat = new Date();
dat.setYear(y);
dat.setMonth(m - 1);
dat.setDate(d);
dat.setHours(11, u + 50, 00, 00);
alert(y + ":" + m + ":" + d + ":" + u);
var ParentName = $(this).find("ParentName").text();
var ChildName = $(this).find("ChildName").text();
var VaccineName = $(this).find("VaccineName").text();
window.plugin.notification.local.add({
id: index,
title: 'index',
date: dat,
//date of vac
message: "vaccine"
autoCancel: true,
sound: 'android.resource://com.alia.workshop/raw/a'
});
window.plugin.notification.local.onclick = function(index, state, json) {
localStorage.setItem("date", dat);
window.location.replace("New.html");
};
});
window.location.assign("~/ParentProfile.html");
},
error: function() {
alert("nooo");
}
});