android

Auto manage your Android phone’s connectivity

Today I would like to show you a way of making your phone a bit smarter, more secure and private and save some battery in a simple manner just by using free and open source software.

The idea is to automate your phone to learn when features such as wifi and bluetooth should be enabled without user intervention. Some benefits of doing this are

  • Security: if your bluetooth or wifi are open at all times, there will be more chances for attackers to take advantage of vulnerabilities that affect them, such as this recent one.
  • Privacy: you phone will leak things such as your MAC address and SSID list while scanning for available networks. This is regularly monitored in places like malls to track user’s movements.
  • Battery saving: having these network interfaces only enabled for as long as they are really needed will decrease your battery consumption.
  • Convenience: everything is automatic… you don’t have to think about it.

This is just the way I combine a couple apps, and it might not fit your needs exactly but I think it might inspire you to achieve similar results.

This can also be achieved by other means, such as using Tasker, but this app is not open source, plus it is overcomplicated and somehow difficult to set up.

LineageOS profiles

This is a very underlooked feature that started coming included in Cyanogenmod. In a nutshell, it allows you to specify combinations of parameters, such as wifi state, bluetooth state, screen brightness, or sound settings and associate them to different profiles.

For instance, I want to turn off wifi, turn on bluetooth and turn on GPS in my car, but I want exactly the opposite at home. Instead of switching all three settings, or even having them on at all times, it is easier to change to the profile car, or the profile home.

This is an example of the typical profiles I set up on my phone

But what’s really cool is that you can set triggers for the profiles, so for instance, you can switch automatically to home when you connect to your home wifi network, and to car when you connect to your car bluetooth.

As a little extra tip, you can also configure your phone so that it won’t get locked, and therefore will not need to be unlocked whenever you are in a safe place, like your work, home or car.

You can find this setting in the profile configuration, but in modern Android versions, it will be greyed out and unavailable because of system policies. Because encrypted phones require a screen lock pattern to be active, and recent Android versions encrypt your phone by default, as it should be, this option will be unavailable.

The workaround is simple, just temporarily lift the screen lock setting

The setting will now be available to be modified. Do so for your trusted profiles

And finally, set your screen lock back. You won’t need to unlock your phone at home or in the car. The screen might go off, but the phone will remain unlocked.

Smarter Wifi Manager

We now have automated our profiles based on our wifi and bluetooth current connection. The missing piece of the puzzle is to be able to monitor the phone cell tower where we are located.

In order to do this, we can download Smarter Wi-Fi Manager from F-Droid. You can follow these instructions to install F-Droid if you haven’t yet.

This app will learn in what cell towers we turn wifi on and off, and from that will automatically turn on wifi whenever we are at work or at home, and off otherwise.

 

Putting it all together, this means that whenever we for instance leave home,  the following will happen.

  • We will lose connection to our home wifi
  • Our bluetooth will become active as per the leaving home profile, and our wifi will be disabled. Our screen will now be locked.
  • When we approach the car, the bluetooth will be already on and will connect, also turning on GPS and unlocking the screen as per the car profile
  • When we leave the car, bluetooth will be disabled, as well as GPS. The screen will be again locked.
  • If we are on our way to work or home, the cellular tower will be detected and wifi will be turned on.
  • As we enter our workplace, we will connect to wifi and our phone will again be unlocked. Bluetooth will also be off if for whatever reason we turned it on, or we didn’t use the car after leaving home.

As this is just an example, hopefully you will find it inspiring to find your own combinations.

Author: nachoparker

Humbly sharing things that I find useful [ github dockerhub ]

4 Comments on “Auto manage your Android phone’s connectivity

  1. Hi Nacho,
    Happy New Year!!!
    Thanks for this interesting article.
    At present I’m not using an Android phone. But I don’t know for much longer, as it is getting a bit old. Do you think an Android phone is more suitable in terms of using free and open source software?
    Best,
    Jan

      1. > Definitely, Android and the F-Droid app store is the way to go for FOSS!!

        Well in the article, you already use lineage os, possibly without google services. https://eelo.io could be a promising derivate, and ubports.com wants to ship android/F-Droid compatibility.
        But the traditional *nix FOSS seems only to merge with the mobile world on the purism 5.

Leave a Reply

Your email address will not be published. Required fields are marked *