Block widgets – Android widgets for my smarthome


I love this word. I love automating things, no matter the cost. For example the PHP framework I’ve written and been using for all my bigger projects automatically generates the tables in the database based on their classes, while the modules containing said classes are automatically distributed to every subscribed project.

It’s great having a system to read and write data and trigger other stuff based on it, but there’ll still always be some kind of dashboard needed to display everything interesting to the user at once. My idea was to simply specify the type of the information a block holds in more detail and make it accessible from outside so that external applications can grab the block data and actually know what they’re dealing with.

A few days ago I didn’t know anything about app development besides Java being the common choice here. Fortunately I already had some experience with Java. After a few hours of Android dev tutorials here and a lot tinkering there I finished my app: a widget that I can add to my homescreen, set its corresponding read- and writekey and then just use. It’s pretty great: once the keys are set, the widget grabs the info from my system and shows the fitting UI element.

It’s pretty awesome and works really well, after all I develop my projects as if I would sell them one day. Ease of use and acceptable performance isn’t that hard to achieve. But all of this is futile if it works greatly only for a few minutes. My OnePlus 3 uses OxygenOS, some custom Android ROM developed by the makers of the phone. Unfortunately, this includes a highly sensible something running in the background killing processes which dare to even look at the precious phone resources. All of my widgets share one thread that does a single request every two minutes in order to grab new data or type changes and then updates all of them. It’s really nothing extraordinary, weather apps for example do requests for their data as well. I tested the widget on my Nvidia shield portable as well, and everything’s fine there. The result? An app designed specifically for my smartphone that works on every newer Android device but my smartphone. Great.

I’m sure I’ll figure something out eventually, as always. The widget works greatly on my Nvidia Shield for example, and has the potential to be an integral part of my system. I just have to make it run on my phone as well. For that though, I need to get deeper into Android sometimes in the future.