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


Low Battery Notification

// Issue a notification when battery level is under 20%

triggered = false;
while(true) {
  // wait for the battery level changed intent
  // the second parameter makes the function ignores the first event which arrives immediately
  result = waitForIntent("android.intent.action.BATTERY_CHANGED", true);

  // this checks the level parameter form the battery intent, but there are more e.g.: temperature
  if (result["level"] < 20) {
    // Notify the user that battery is low - status bar
    if (triggered == false) {
        notify("Battery low", true);
        triggered = true;

  // reset the flag if battery gets charged again
  if (triggered) {
    if (result["level"] > 19) {
        triggered = false;

  // wait for a while if intents are coming too fast



  1. An automotive battery is a type of rechargeable battery that supplies electric energy to an automobile. get redirected here


  2. Great article! We are linking to this great article on our site. Keep up the good writing.

    3 شركة مكافحة حشرات بالمدينة المنورة
    شركات مكافحة الحشرات
    مكافحة حشرات بالرياض
    مكافحة حشرات بالمدينة

  3. Pretty! This has been an incredibly wonderful article. Thank you for providing this info.
    شركات كشف التسربات
    شركة كشف تسربات بجدة
    شركة كشف التسربات بمكة
    شركات كشف تسربات وعزل بالمنطقة الغربية

  4. Very good post. I'm facing some of these issues as well..

    عقاري جدة
    شقق مفروشة بجدة
    شقق عزاب بجدة


  5. Great article! We are linking to this great article on our site. Keep up the good writing.

  6. Very useful information, I have tryed to run this script and it really works! Thank you. See also information on this site