Pages

Labels

Sample (14) Intent (5) Media (5) Location (4) Funny (3) HTTP (3) Sleep as Android (3) WiFi (3) Alarm (2) Recording (2) Regexp (2) Array (1) Basic (1) Battery (1) Browser (1) Calculator (1) Contacts (1) Content Provider (1) Cron (1) Dialog (1) Dictionary (1) Export (1) Function (1) GUI (1) Game (1) Loop (1) Random (1) SD Card (1) Social (1) Temperature (1) Text to Speech (1) Weather (1)

Search Scripts

2015-04-08

Turn wifi on when home or work and off when out

// Turn wifi on when home or work and off when out

loc = location();
log("Current location lat: " ~ loc["lat"] ~ " lon: " ~ loc["lon"]);

while(true) {

  // put your work location here
  iAmWork = near(10, 20, 700);
// put your home location here
iAmHome = near(10, 30, 100);
  if (iAmWork) {
    log("At work");
    enableWifi(true);
  } else if (iAmHome) {
    log("At home");
    enableWifi(true);
    } else {
    log("Out");
    enableWifi(false);

  }  
  // wait 2 minutes till next check
  sleep(120000);

}

  

1 comment:

  1. شركة تنظيف سجاد بالرياض
    تقدم شركتنا افضل الخدمات المنزلية علي الاطلاق حيث انها تقدم خدمات التنظيف المتكاملة مثل تنظيف المنازل والبيوت والفلل والقصور وتنظيف الموكيت وتنظيف الكنب وتنظيف الستائر وغير من العمل النظافة يمكنك زيارة موقعنا لانها هي الافضل علي الاطلاق حيث انها توفر كل الخدمات التاليه:
    ارخص شركة تنظيف منازل بالرياض
    شركة تنظيف ستائربالرياض
    شركة غسيل كنب بالرياض
    شركة تنظيف مكيفات بالرياض
    شركة نقل اثاث بالرياض

    ReplyDelete