From the last article, you know that I spend quite a bit of my time on a train. It's an excellent time to write an article or two, provided I have access to the Internet to look up facts and ideas. Tethering can be tricky on the train, as reception-less areas are scattered across my route. I find it quite easy to tell that I’m about to go offline when I’m in a tunnel, but the situation is less apparent when the train cruises through the open meadows of North Yorkshire. Android's built-in tethering solution doesn’t have any way to let you know that you are not going to be able to load that website for the next 5 minutes.

That's why, as a Tasker aficionado, I thought about how to solve my problem using the popular Android automation app. I've solved my problem by building a tethering 'no network' warning using Tasker. The aim of the project is to let you know when your phone no longer is in cellular network range. This will be done in 3 ways:

  • Using notification LED (best for when you tether for friends)
  • Using a smartphone icon (needs a smartwatch)
  • Using a Join push (best for personal devices -can be replaced with AutoRemote)

You can get more creative with notifications, however, I will use only discrete options as tethering is most likely to be used in public places. No one likes obnoxious notifications, right? Please bear in mind that the notifications will use an internet connection to show up on the connected device. You could use AutoRemote (via Bluetooth) to send out warnings when the network is not present. This will require the device in question to be paired via Bluetooth.

You will need:

Android version: 4.0+, Android 7.0 needed for the notification tile

Apps: Join

Plugins:  AutoWear (optional), AutoRemote (can replace Join), AutoNotification (optional)


Enable a tethering 'no network' warning with Tasker

Instead of checking if tethering is enabled, it’s easier to replace a tile in the status bar with AutoNotification and set up a toggle behavior. If you are not on Android 7.0 you can use a shortcut or a widget instead.

If you have never enabled a tile with AutoNotification - you will see that this is a bit awkward. You will need to create a setup task which will convert a template tile into a tile of our choice. Place an empty tile, i.e. AutoNotification 02 onto the tiles area (click edit to edit the visible tiles).

Create a Tethering tile

You will only need to run this once to set up the tiles and variables. The tile will use a command hotspottoggle to change the state of tethering and will set it as inactive. It will also collapse the status bar once pressed. You can dress up the tile with a label of your choice and the icon.

Two more variables will be created and set to 0. %HotspotVariable will display the status of the tether (0 = no, 1 = yes) and %HotspotDialog will display a dialog asking us what device we want to notify (0 = do not show, 1 = show dialog).

Tethering toggle

I want to display a dialog only when tethering is enabled. The dialog will show some devices I own and will allow me to set the target for the notifications. In each case, I will set my tethering phone to blink the notification LED rapidly each time the reception is poor.

When the tile is pressed, it changes the status to active. %HotspotDialog changes to 1 and it triggers the HotspotDialog task. While we select our device, the Hotspot profiles are armed by setting the variable %HotspotVariable to 1. When I press on a tile again to end tethering, the HotspotDialog returns to 0 and no longer prompts the dialog to be displayed, and the %HotspotVariable is set to the neutral value 0.

A1,A6

The action Variable Add +1 will change the value of our starting variables from 0 to 1 and will wrap it around 2. This means these variables will always take values of 1 or 0. The action placement is relevant as well, as the %HotspotDialog will control when the dialog is displayed. We are running the same task to disable and enable the tethering, but we don't want the dialog to appear each time we toggle it.

A7

While we are at it, if the task is performed to disable the tether (%HotspotVariable = 0), we want to clear the variable that stores the name of the device which gets notified by the Hotspot Dialog task.

A5

The Wait action is added to prevent the information about poor range from being displayed straight away which may happen when the hotspot setting is toggled.

A3

Simply toggle the WiFi tether action. Nothing complicated about this step.

A4

A separate task is displayed to show the AutoTools Dialog and action for the choice I've made. This will run when our dialog controlling variable %HotspotDialog = 1.

A2

When the toggle is pressed, we want to make sure that the tile toggles the state active/inactive and retains the same command: hotspottoggle. Lastly, make sure it will collapse the status bar.

Hotspot Dialog

The AutoTools dialog is used to display available devices. When the device is selected, dialog will close and set the value of the %HotspotDevice to the name of that device. This variable gets cleared each time the tethering is stopped.

Poor reception/No data

I have created 2 profiles which will check the signal strength and the Internet connection. Each one is controlled by the variable %HotspotVariable and is only active when tethering is enabled. Both profiles will trigger the same task when activated and deactivated. One contains the state context - signal strength -  and the other the mobile network. Ideally, the connection will be still present when the notification is issued. This is why I'm including the signal strength set to 1 in the profile condition.

Poor Signal

The AutoNotification notification is created on the phone, but only to make the LED blink. Choose the other values of the notification to your personal liking and set fast LED blink (mine is 300ms on/off) in your preferred color. The idea is to display discrete information rather than a fully invasive alert when the screen wake. The notification is saved as a permanent notification with ID 55.

What follows next is a Join push for each device you own. Select a Join push for each device, and use the IF condition to match the value of %HotspotDevice variable.

Configure the Join push action to send a notification of your choice. Since these notifications will be dismissed on the target device, no other actions are needed.

SmartWatch

You will notice that I have changed the way the notification works for the smartwatch. None of the above will show up on my watch. The only thing I want to show on my watch is a small icon which can be dismissed on request.

Create an icon using AutoWear Manage Floating Icons *(you have to go to the AutoWear app) and test the size and placement on your watch. The icon will draw over any screen, so make sure it contain a command on tap to close it. I used closepoorrange and named the icon poorrange. The size of my icon is 30x30 pixels and it is placed 65% to the right and 20% from the top.

Once you are happy with the size and location - use the AutoWear App action to show the icon and the IF condition to link it to the %HotspotDevice variable.

Cancel

To end the LED blink and remove the floating icon from the watch, I’m going to use a simple AutoNotification Cancel action with the ID of my notification (55) to perform the AutoWear App action which hides the floating icon.

The smartwatch has an additional profile that will remove the floating icon if the icon is pressed. To do this I use the AutoWear Command event ‘closepoorrange’ then I run a separate task that contains pretty much the same action as the Cancel task.


We hope you enjoy this little creation of ours, and let us know if you think we can make any enhancements! As always, you can download the project by clicking the link below.

Download the Tethering 'No Network' Warning Project File here!

In order to import the tethering 'no network' warnings with Tasker project file, download the above file and save it anywhere in your internal storage. Open up Tasker and check to make sure that "beginner mode" is disabled in the preferences menu. Then, long-press on the "home" icon in the bottom left hand corner and click on "import". Find the prj.xml file you saved earlier, and select it to import it. You will now see a new tab in the bottom row containing all of the profiles and tasks we referenced in this article.