Automatic Email Low Battery

This Step-through explains how to have your phone email you once an hour if the battery level falls bellow a threshold until it is plugged in. It uses gmail's SMTP server. So you would have to create an account or modify the python script. Since the password for the account will be in plaintext you might want to make a new gmail account just for using these scripts.

Install SL4A and the python interpreter

You will need to install scripting-for-android and the python interpreter in order to run the python scripts which create the email.

  1. Go to the following to install latest SL4A
  2. Install the python interpreter for SL4A using these instructions here:

Import python script and create/import tasker profiles

The python script and xml files for the tasker profiles are attached.

Even if you want to heavily edit these profiles for a completely different usage, if it's your first time using tasker, I still suggest you import the profiles to see how the programming logic, variables, etc function, and then change them to suit your needs.

To import:

1. Download the 3 attached files
2. Open a text editor, search, and edit 4 lines in Low_Batt_And_Unplugged.prf.xml:

  • '(RECEIVING EMAIL HERE)' Replace this text with the email you want to RECEIVE the low battery notification
  • '(YOUR EMAIL PASSWORD)' Replace this text with your gmail password
  • '(YOUR EMAIL USERNAME)' Replace this text with your gmail username (without the '')
  • 'Phone battery level is %BATT' Optionally replace this text with an email subject of your choice

3. Copy the file to your phone's storage /sdcard/sl4a/scripts/
4. Copy the two xml files to your phone's storage to an easy location (you will import these files from the tasker app)
5. Inside (the newest version of) tasker tap on 'Profiles' and select import. Navigate to the location of the xml files above and import each of these
6. Your screens should look like this:


You can modify many things in these profiles, such as:

  • the battery threshold
  • frequency of email reminder
  • a different notification (besides battery level)
  • prompt for email

And much more. However, these are entirely dependent on your usage and are beyond the scope of this article. You'll have to play around with the options, read up on tasker info, and google for answers.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License