Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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")
- }
- }
- })
- this.storage.get('AlertOn100').then((val) => {
- var flag = localStorage.get("flag");
- if (val==true && !flag){
- 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
- });
- localStorage.set("flag", true);
- 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")
- }
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement