From the last video,  you know that I spend a bit of my time on a train. An excellent time to write an article or two, providing I have the internet to look up facts and ideas. Tethering can be tricky on the train, as reception-less areas are scattered across the route. I find it 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 tethering doesn’t have anything to let you know, that you are not going to load that website for the next 5 min.
Time to get this solved with a tethering profile with Tasker. The aim of the project is to let you know when your phone no longer is in range.  This will be done in 3 ways:

  • Using notification LED (best for when you tether for friends)
  • Using a smartphone icon (need 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 the public places. No one likes obnoxious notifications right?

Enable tethering Tasker profile

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 the Android 7.0 you can use a shortcut or a widget instead.
If you 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 ie 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

Remove Watch IconHotspot ToggleNo DataPoor Reception
Profile: Remove Watch Icon 
	Event: AutoWear Command [ Configuration:Command Filter: closepoorrange
		Case Insensitive: false
		Exact: true
		Regex: false
		Variable Array: false ]
Enter: Close WearIcon 
	A1: AutoWear App [ Configuration:Execute Now: true
		Trigger Event: true
		Haptic Feedback: true
		Name: App
		AutoWear Elements: Hide
		AutoWear Element Id: poorrange
		Turn Screen On: true Timeout (Seconds):60 ]
Profile: Hotspot Toggle 
		Event: AutoApps Command [ Configuration:Command Filter: hotspottoggle ]
Enter: Hotspot Toggle (
	A1: Variable Add [ Name:%HotspotDialog Value:1 Wrap Around:2 ] 
	A2: AutoNotification Tiles [ Configuration:Tile: 2
		Command: hotspottoggle
		Label: Hotspot
		Icon: android.resource://net.dinglisch.android.taskerm/hd_aaa_ext_signal
		State: 999
		Require Unlock: false
		Hide Notifications: true Timeout (Seconds):60 ] 
	A3: WiFi Tether [ Set:Toggle ] 
	A4: Perform Task [ Name:Hotspot Dialog Priority:%priority 
		Parameter 1 (%par1): Parameter 2 (%par2): 
		Return Value Variable: Stop:Off ] If [ %HotspotDialog ~ 1 ]
	A5: Wait [ MS:0 Seconds:5 Minutes:0 	Hours:0 Days:0 ] 
	A6: Variable Add [ Name:%HotspotVariable Value:1 Wrap Around:2 ] 
	A7: Variable Clear [ Name:%HotspotDevice Pattern Matching:Off ]
		If [ %HotspotVariable ~ 0 ]
Profile: No Data 
	State: Variable Value [ %HotspotVariable ~ 1 ]
	State: Mobile Network [ 2G:On 3G:Off 3G - HSPA:Off 4G:Off ]
Enter: PoorSignal 
		
	A1: AutoNotification [ Configuration:Use HTML: false
		Title: Poor reception
		Icon: android.resource:
		//net.dinglisch.android.taskerm/hl_device_access_network_cell
		Status Bar Icon: device_access_network_cell
		Status Bar Text Size: 16
		Id: 55
		Priority: -1
		Persistent: true
		Is Group Summary: false
		LED Color: red
		LED On: 300
		LED Off: 30p
		Skip Picture Cache: false
		Update Notification: false
		Only on Phone: true Timeout (Seconds):20 ] 
			
	A2: Join Send Push [ Configuration:Device: Chrome@Laptop
		Text: Poor range
		Title: Poor reception Timeout (Seconds):60 ] If [ %HotspotDevice ~ Laptop ]
			
	A3: Join Send Push [ Configuration:Device: Chrome@Home
		Text: Poor range
		Title: warning Timeout (Seconds):60 ] If [ %HotspotDevice ~ Computer ]
			
	A4: Join Send Push [ Configuration:Device: Tablet
		Text: Poor range Timeout (Seconds):60 ] If [ %HotspotDevice ~ Tablet ]
	A5: AutoWear App [ Configuration:Execute Now: true
		Trigger Event: true
		Haptic Feedback: true
		Name: App
		AutoWear Elements: Show
		AutoWear Element Id: poorrange
		Turn Screen On: true Timeout (Seconds):60 ] If [ %HotspotDevice ~ Watch ]

Exit: Cancel 
	A1: AutoNotification Cancel [ Configuration:Id: 55
		Cancel All: false Timeout (Seconds):0 ] 
	A2: AutoWear App [ Configuration:Execute Now: true
		Trigger Event: true
		Haptic Feedback: true
		Name: App
		AutoWear Elements: Hide
		AutoWear Element Id: poorrange
		Turn Screen On: true Timeout (Seconds):60 ] If [ %HotspotDevice ~ Watch ]
Profile: Poor Reception 
	State: Variable Value [ %HotspotVariable ~ 1 ]
	State: Signal Strength [ From:0 To:1 ]
Enter: PoorSignal 
	
	A1: AutoNotification [ Configuration:Use HTML: false
		Title: Poor reception
		Icon: android.resource:
		//net.dinglisch.android.taskerm/hl_device_access_network_cell
		Status Bar Icon: device_access_network_cell
		Status Bar Text Size: 16
		Id: 55
		Priority: -1
		Persistent: true
		Is Group Summary: false
		LED Color: red
		LED On: 300
		LED Off: 30p
		Skip Picture Cache: false
		Update Notification: false
Only on Phone: true Timeout (Seconds):20 ] 
	
	A2: Join Send Push [ Configuration:Device: Chrome@Laptop
		Text: Poor range
		Title: Poor reception Timeout (Seconds):60 ]
		If [ %HotspotDevice ~ Laptop ]
			
	A3: Join Send Push [ Configuration:Device: Chrome@Home
		Text: Poor range
		Title: warning Timeout (Seconds):60 ] If [ %HotspotDevice ~ Computer ]
			
	A4: Join Send Push [ Configuration:Device: Tablet
		Text: Poor range Timeout (Seconds):60 ] If [ %HotspotDevice ~ Tablet ]
	A5: AutoWear App [ Configuration:Execute Now: true
		Trigger Event: true
		Haptic Feedback: true
		Name: App
		AutoWear Elements: Show
		AutoWear Element Id: poorrange
		Turn Screen On: true Timeout (Seconds):60 ]
		If [ %HotspotDevice ~ Watch ]

Exit: Cancel 
	A1: AutoNotification Cancel [ Configuration:Id: 55
            Cancel All: false Timeout (Seconds):0 ] 
	A2: AutoWear App [ Configuration:Execute Now: true
	    Trigger Event: true
	    Haptic Feedback: true
	    Name: App
	    AutoWear Elements: Hide
	    AutoWear Element Id: poorrange
	    Turn Screen On: true Timeout (Seconds):60 ] 
            If [ %HotspotDevice ~ Watch ]

I want to display a dialog only when the 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 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 the choice 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 %HotspotVariable, and only active when the 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.

Poor Signal

The AutoNotification Notification is created on the phone, but only to enable 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 the preferred color. The idea is, to display a discrete information rather than a full invasive alert with a screen wake. The notification is saved as permanent with ID 55.
What follows next, is a Join push for each device type you own. Select a Join push for each device, and use IF condition to match the value of %HotspotDevice variable.
Configure the Join push action to send a notification of your choice. Since they will be dismissed from 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 AW app) 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 in pix 30 and its placed 65% to the right and 20% from the top.  Please remember these are in percentages not in pixels.
Once you are happy with the size and location  – use AutoWear App action to show the icon and 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 simple AutoNotification cancel action with the id of my notification (55) and 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 AutoWear Command event  ‘closepoorrange’  (exact)  then I run a separate task, that contains pretty much the same action as the Cancel task.

SHARE