Affiliate links on Android Authority may earn us a commission. Learn more.
How to create a basic battery log using IF and Box - Android customization
Did you go crazy with last week’s Android customization tutorial, popping up notifications on your Android device for any number of actions that take place either on your device or across the internet? Our fitness tracker and daily reminder were really simple examples, I hope you took it to the next level.
This week, as we continue with IF by IFTTT, we would like to create a basic log of our battery data. IF has limited tools on the topic, check it out and if you feel you need more, hold off for next week, we’ll be creating an advanced battery log data project using a tool with more power.
Before we begin
Also, you will need to have an active cloud storage account at Box. If you are not signed up already, head to Box.net to sign up for your free account. They have optional paid accounts as well, but you’ll not need worry about that for our project today.
IF Recipe to save basic battery data to a log file
The idea is fairly powerful, but pretty simple, we will collect battery information when your Android device is plugged in, again when it is unplugged and yet again when your battery is low. This data will then be saved to a simple text file saved on your Box cloud storage.
We will be building three recipes today, as it turns out, but don’t worry, the process and all but one item is the same throughout. I will walk you through it once, then you just need to repeat the steps for each battery activity. You’ll see, it’s easy.
Open IF either on your Android device or on the web.
Start a new Recipe.
Scroll to the Android battery section and select your desired battery event. These three options – Battery is low, Device is plugged in and Device is unplugged – represent the three recipes you might make today. So choose which you want to make first, and come back here to make the rest later.
Click the required buttons to confirm the trigger and start on your action.
Scroll to Box and choose Append to a text file.
Now is some important stuff, the info you enter here will need to remain the same on each of your Recipes, unless you want a new file for each action.
For File name, enter the name of a text file that you already have stored in Box or just make sure that the file name does not exist and IF will create it for you. Be default IF enters “Android Battery” but you know me, I like concise names, so I’ll put “Battery.txt“.
In the Content field, enter any and all info that you want saved to the text file. The default string is pretty good for our needs. Perhaps you can satisfy my grammar needs and change up the “a” for an “an” in the Device plugged in recipe, you’ll see what I mean in a moment.
Finally, in the Box folder path, enter the exact folder location of the text file in Box. Once again, it defaults to “…/Android Battery” and once again I will rename it just “…/Battery“.
Click Continue to proceed.
Review your new Recipe and click Finish to save things and move forward.
Look at that, the hard part is out of the way, now you just need to practice what you’ve learned and duplicate this IF Recipe for each of the other two Android Battery triggers.
Remember, when you are creating the other Recipes, carefully duplicate the file name and box folder path info so that everything is written to the same file.
Now to see the fruits of your labor. Once you’ve plugged and unplugged your device a few times, head on into Box.net and search out that Battery.txt file you’ve been working on. It is not much, but a great way to see how long you’ve been leaving your device on the charger. If you are like me, perhaps this will help you be more aware and try to leave your device on the charger for shorter lengths.
Although we focused on saving battery data in this project, I hope that you are imagining all of the other great things you could have automatically write to a text file in Box. For example, I’ve been keeping track of the local college sports team (GO DUCKS!)
An interesting predicament: do you have more than one Android device? Of course you do, and if you are using IF, then you may have it installed on multiple devices as well. Guess what, IF does not readily take this into consideration, my log file is filling with data from several connected Android devices, which is precisely why we will revisit the idea of this project again next week.
Did you get what you needed out of this Android customization post, putting IF to task at saving battery data into a log file on Box? If this project was a good intro to saving files to Box, but not an in-depth enough project to track your battery, join us next week, we’ll take this to the next level.
As a heads up, next week we’ll use Tasker instead of IF and store a file locally instead of to the cloud. The capabilities of Tasker far outdo that of IF, and we plan to have some fun with it.
Do you use IF to collect battery data or to save other info to a text file? Please share, we love to hear of great new Recipes.