Over the last few weeks our Android customization series has provided some great ideas and tricks to manage and reduce power consumption. We would like to take a little break from battery life tools this week to focus on the weather.
With it being that time of year for us northerners, leaves are beginning to turn brown and the weather is beginning to cool down. Now may be a great time prepare for bad weather days by creating a little weather warning system right on your Android device Homescreen.
Chances are, if you’re still reading this, you are interested enough in your weather that you already have a weather widget on your device. And if you’ve been following our customization series, you may even already use Zooper Widget. If this describes you, then you already have the hard part complete and ready to roll today.
Before we get started
You will need Zooper Widget installed on your Android device. The free version will get you by, but if you’ve been testing out all of these Zooper Widget projects, you may have already invested your $2.49 for Zooper Widget Pro in the Google Play Store.
Before proceeding, I will leave it to you to create your own Zooper Widget with a weather indicator. We’ve walked through this before, but you’ll likely want at least the weather scalable icon set in your widget.
We’re going to try to keep it simple, all I want to do is adjust a weather icon to reflect upcoming problematic weather. Specifically, what I want is for my weather icon/indicator to turn red and/or change size if unfavorable weather is headed my way.
This is a modified approach to the techniques we looked at to change the color of your battery indicator based on power level from a while back. That should make this pretty easy. Let’s do this in order, from the beginning:
Create your widget.
Add a weather icon or text element with the weather.
Head to the Advanced parameters section of your weather indicator.
Now, enter only one of the following code snippets, for now. You can come back to mix and match to create your own custom super tool later:
When today’s temperature is to be below 40F, change the indicator blue:
When there is snow in the forecast, change the indicator red, and enlarge it:
(This assumes that your weather indicator has a default size of 30, thus a size of 60 is a major increase. You will need to identify the default size of your indicator and adjust accordingly.)
Too easy so far? Let’s step it up – When the weather condition is going to be severe today, like a thunderstorm or snow, we’ll do something drastic, like still just changing the indicator to red.
What is going on here?
I best break that down a bit. #W0COND# breaks into W=weather, 0=today (alternatively, C=current, 1=tomorrow, etc) and CODE=is a weather condition code. All available condition codes can be found here but may act differently depending on your set default weather provider. I have chosen to work with Yahoo! as my provider, you may find that either Open Weather Map (which is the usual default) or Yr.no works better in your area. Change that up in your default Zooper Widget settings.
Back to that string of code, you’ll see I used “&&” and “||” which indicate AND and OR, respectively. So, what we really said up there was ‘if the weather code is greater than or equal to 1 AND below 3, OR it is exactly 8, change the color.’ You’ll have to run through that list of weather codes to decide what you want to check for.
Now that that is all over, be sure to hit the check mark in the top right corner of the screen to save and exit. Then hit the system Back button to save and exit right out of Zooper Widget.
Please do not be discouraged if things are not quite right the first time around. You will have to play with this to see what works best for you. Myself, I tweak and modify my code almost monthly, and at the very least, adapt to the season with more controls for snow and cold during the winter and granular checks for high temps in the summer.
This project started off sounding fairly simple, but revealed some very detailed and complicated techniques, leaving you with tons of options and lots to think about. When you get the hang of what you see here, try combining the weather attributes so that you can adjust your weather icon to account for temperatures, conditions and even humidity levels and wind speeds. You can then still change colors and sizes of elements, but you could also use a dedicated warning icon or text that moves into view when the time is right.
Lastly, and we won’t get into this, don’t forget that Zooper Widget plays nice with Tasker.
As we close out a topic about notifications of one sort in our Android customization series, I’d like to start looking at notifications in general on your Android device. We’ll begin a multi-part series on handling notifications, partially inspired by what is to come from Android L, and partially inspired by apps that attempt to duplicate that Android L functionality, like HeadsUp!
What do you think about our little weather warning system – I do hope you never see it activated for severe weather, but let us know how it goes and what modifications you have done to make it better?