0
我正在構建一個應用程序,該應用程序每30分鐘呼叫一次服務請求客戶端擁有的其餘單元的值。在檢查期間,如果客戶端的單位低於指定的單位,應用程序將發送一個本地通知,表明這些單位運行不足。一切工作正常。Ionic Angular運行計劃通知一次
我遇到的問題是,如果我們說客戶有90個單位,限制爲100,應用程序將發送通知罰款,但30分鐘後,當它再次檢查,看到客戶有85個單位,它會一次又一次地發送,直到客戶端充電。我想要的是通知發送一次。任何幫助將不勝感激。以下是我的代碼。
this.storage.get('AlertOn100').then((val) => {
if (val==true){
if(res.power<100 && res.power>50){
LocalNotifications.schedule({
title: "Electricity is below 100 Units",
text: "Please recharge to avoid running out",
at: new Date(new Date().getTime() + 1 * 60 * 1000),
sound: null
});
console.log("Units Below 100 . The guy should be notified")
}else{
console.log("Don't send notification at 100 Units because the units are above that value")
}
}
})
嘿,非常感謝。有用 。並抱歉遲到回覆。 – bobin56
不用擔心隊友:) –