Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. this.storage.get('AlertOn100').then((val) => {
  2. if (val==true){
  3. if(res.power<100 && res.power>50){
  4. LocalNotifications.schedule({
  5. title: "Electricity is below 100 Units",
  6. text: "Please recharge to avoid running out",
  7. at: new Date(new Date().getTime() + 1 * 60 * 1000),
  8. sound: null
  9. });
  10. console.log("Units Below 100 . The guy should be notified")
  11. }else{
  12. console.log("Don't send notification at 100 Units because the units are above that value")
  13. }
  14. }
  15. })
  16.  
  17. this.storage.get('AlertOn100').then((val) => {
  18. var flag = localStorage.get("flag");
  19. if (val==true && !flag){
  20. if(res.power<100 && res.power>50){
  21. LocalNotifications.schedule({
  22. title: "Electricity is below 100 Units",
  23. text: "Please recharge to avoid running out",
  24. at: new Date(new Date().getTime() + 1 * 60 * 1000),
  25. sound: null
  26. });
  27. localStorage.set("flag", true);
  28. console.log("Units Below 100 . The guy should be notified")
  29. }else{
  30. console.log("Don't send notification at 100 Units because the units are above that value")
  31. }
  32. }
  33. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement