FreeAir - Android widgets for PurpleAir

Wanted to share that I’ve made a free Android widget for PurpleAir sensors: FreeAir android widget for PurpleAir.

I’ve wanted this for a while and recently retired, so I put it together. I’d love to hear your thoughts!

Currently it requires a PurpleAir API key - which you can get on mobile for free in a few clicks, but it is still a pretty gnarly user experience for me to require that. I may talk to PurpleAir to figure out if we can work around that.

It supports multiple sensors. Light/dark modes. Sizes from 2x1 and larger. Uses a ring to indicate indoor/outdoor. Supports phones & tablets… and it’s open-source.

I’d love to hear from anyone who uses it & has any feedback… thanks!

3 Likes

Hello. Thank you for creating a very useful widget. I installed without any issues and it works well. A couple of thoughts:

  1. The white background stands out compared to all of the other items on my home screen. Please consider adding an option to change the color of the background or make it transparent and automatically adjust the location text appropriately.
  2. Please consider adding a 1x1 widget that just shows the AQL circle with a transparent background.

-Chris

2 Likes

Found your widget through Google because I was having the same annoyance having to open the site to check. Like you said, the API is a bit weird; initially it refused to accept the key but after a few minutes it started working. Also found out if you log in with l Google, but don’t have a last name set, it refuses to let you generate an API Key which seems kind of ridiculous. But I was able to temporarily add a last name in my Google account, generate a key, then remove it.

Like the other comment said, a 1x1 option could be helpful since my home screen is pretty packed. The one other feature that would be incredibly helpful would be an option to have the sensor change based on whichever sensor was the closest. But I’m not sure if that’s feasible with the current setup using a personal API key? But I will say the widget does what it’s designed to do very well; I really appreciate the time you put into building it!

Glad you enjoyed it :slight_smile:
I’ve just submitted an updated version which includes a 1x1 widget focused on the AQL circle.

I hear you on the white bg when in light-mode, I’ll be thinking more about backgrounds/colors/transparency for later releases.

Thanks!

1 Like

Thanks for the feedback! I’ve just submitted an update with 1x1 widget support and a “current location” option for widgets that don’t want to specify a static sensor ID.

It looks like Google needs to review each version so it might be a couple of days before it goes live.

Thanks again for the feedback & glad you’ve found it useful!

Awesome, I can’t believe you were able to implement those features so fast! But the update just went live within the past hour. But it seems to be working great!

I don’t understand the intricacies of the PurpleAir sensor network, but this does confirm a bit of an odd quirk. I had noticed with the IQAir app that when I select proximity, it defaults to a sensor that appears to be about a mile further away than another sensor. I had assumed it was a weird limitation of their app, but it seems to be something else, because this also defaults to that sensor as well. The sensor it defaults to is on a city government building, whereas the one that appears much closer is in a residential area.

I’m assuming it’s one of two things:

-The proximity option with the API doesn’t recognize that sensor due to a setting individual users can select, presumably some sort of privacy option.

-Or the marker that appears closer is just meant to indicate the general area and it’s actually located further away (again probably a privacy setting)

I upgraded and added the 1x1 widget to my homescreen. Thank you! I also like the addition of the My Location option. Looking forward to future enhancements.

1 Like

I have noticed a bug in the latest update: at least for me when you select the proximity option, it never updates and the time and the AQI shown never change. I’ve been staying home this weekend due to a migraine and terrible smoke, so it’s possible that moving closer to another sensor would force it to refresh. I’ll have to test that out if I’m feeling better later today.

1 Like

Hi there! You’re right, the first version was not really updating. It turns out it’s because it tries to update while the app is in the background but it didn’t have permissions to do so.

I’ve updated it, so now it asks for the ability to get your location while it’s in the background. After you update, you may have to remove your “current location” widget and add it back to get it working (i seemed to need to do that when I got the update). That update went live early today so you should be able to grab it now.

Hope you feel better soon!

For this one about not getting the closest sensor, that’s interesting… for a little info on how it works:

  • It only looks at outdoor sensors.
  • It uses “approximate location” instead of exact location because that’s slightly better for privacy. My guess is this is where the problem is… approximate location might sometimes fall closer to that other sensor.
  • It asks Purple Air for sensors inside a certain rectangle around your approximate location and then calculates which one of them is closest to that approximate location.

Now that it can actually update reliably, hopefully it’ll guess your closest sensor correctly more often!

Thank you for creating this widget! I was thinking of creating one myself but you saved me the trouble. One suggestion: could you add the US EPA conversion to the data? I find that more accurate. Without it, the AQI numbers are much higher than other data sources.

Hi there! It already is supposed to have the US AQI adjustment in there, so the numbers should match the PurpleAir numbers quite closely (with the caveat that the widget updates every 15 minutes and uses the “instantaneous” reading). It appears to track pretty closely for me while I’m using it… are you seeing something different?

Here’s the code for our US AQI adjustment: freeair/app/src/main/java/com/seancolombo/freeair/airquality/Pm25AqiCalculator.kt at main · SeanColombo/freeair · GitHub

I’m not sure about your code, but if you open the Purple Air map and go into Settings, there is an option to Apply Conversion. There you can select US EPA.

After looking into it further, I think your numbers are correct after all. Adding the EPA conversion to the map data was skewing it downward, and the other data sources I was comparing to were not getting a precise location. Thanks for developing this!