How to Create Custom Fingerprint Actions with Tasker

How to Create Custom Fingerprint Actions with Tasker

If your smartphone or tablet has a fingerprint reader, chances are that its uses are limited. Apart from a few added benefits in the Google Pixel or Huawei smartphone line-up, most fingerprint readers on Android only serve to unlock your device. Fortunately, with the power of Tasker and a few plug-ins, we are able to considerably extend the functionality of the fingerprint scanner. Previously, I did a tutorial on how to assign custom fingerprint actions and make it context dependent. At the time, I only demonstrated how you could cast the current tab to your PC. In this tutorial, I will provide some additional examples of ways you can take advantage of a context-aware fingerprint reader.

But what if your phone doesn’t have a fingerprint reader? Even if you don’t have one on your phone, don’t worry, as we can adjust the scripts to work just as well with an onscreen button. I will even demonstrate how to replicate this set-up with a fully transparent onscreen button, as well! XDA Senior Member Flextrick has updated the Fingerprint Scanner Tools with better Tasker integration, so here are my favorite custom fingerprint actions. At the end of each section, I will provide the Tasker summary for those of you who want to replicate the set-up on your own (and learn along the way), but if you would rather simply download all of the scripts mentioned in this article I’ve provided a download link at the end.


You will need:
Android version: 6.0+ (Used 7.0),
Apps: Join (or AutoRemote), Fingerprint scanner tools (Tasker support need to be unlocked)
Plugin: AutoInputAutoTools, Secure Settings
Needs: Fingerprint Reader


Cast the current Chrome window (Updated)

In the previous article, I demonstrated how you can cast the currently opened Chrome webpage to your PC using Join. Since I published that article, I’ve come up with a few changes that I thought would improve its functionality. While the profile alone does exactly the same thing, I’ve updated the task to cast the page to the selected PC based on what WiFi is connected or an input selected from a dialog. I have also added a toggle to enable then disable the AutoInput accessibility service, as these accessibility services tend to slow down your phone. To do so, I have added a Secure Settings accessibility toggle action as the first and last action in the task. If you struggle to get the Secure Settings plug-in on Android 7.0+ working, look at my solution here or check the run shell options from here.

WiFi Connected Context

WIFI context

WiFi context

Unless you can get the location values from another profile, you will need to create two additional profiles. One will set the variable %Location to home, another to work. Create the profile, WiFi connected, fill in your home SSID, and link the task which will set the variable %Location to home. Do the same for your work WiFi.

Now that we have that part ready, we can update our original task by simply adding an IF condition to the Join Send Push action. A push to the correct device will be issued depending on our %Location variable, which we set based on a WiFi Connected profile as mentioned above.

Chrome Profile

Profile: Connected Home
	State: Wifi Connected [ SSID:FASTBERRY/SLOWFROG MAC:* IP:* ]
Enter: Connected Home
	A1: Variable Set [ Name:%Location To:home Do Maths:Off Append:Off ] 

Profile: Connected Work
	State: Wifi Connected [ SSID:ITC-STAFF MAC:* IP:* ]
Enter: Connected Work
	A1: Variable Set [ Name:%Location To:work Do Maths:Off Append:Off ] 

Profile: Chrome On PC
	Application: Chrome
	Event: Variable Value [ %FingerScanned eq 1 ]
Enter: Chrome
	A1: Secure Settings [ Configuration:AutoInput: service.ServiceAccessibility - Enabled Timeout (Seconds):0 ] 
	A2: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ] 
	A3: AutoInput UI Query [ Configuration:Only Visible: true
Only Clickable: false
App Package: com.android.chrome
Check Screen State: false
Text: ((?<=http:\/\/|https:\/\/|https:\/\/www.|http:\/\/www.|www.))?.*
Regex: true
Variables: address Timeout (Seconds):20 ] 
	A4: Join Send Push [ Configuration:Device: Chrome@Home
Url: %address Timeout (Seconds):60 ] If [ %Location ~ home ]
	A5: Join Send Push [ Configuration:Device: Chrome@work
Url: %address Timeout (Seconds):60 ] If [ %Location ~ work ]
	A6: Secure Settings [ Configuration:AutoInput: service.ServiceAccessibility - Disabled Timeout (Seconds):0 ]

Dialog Context

Dialog

Dialog

If you have multiple PCs you would like to cast to in a single network, perhaps a dialog would be a better option for you. I’m going to use AutoTools to generate a dialog which will consist of names of the PCs that you can cast the current Chrome webpage to. Once clicked – the website will be sent only to that PC. If you are going to use just the dialog, you don’t need to recreate the profiles from above. All you need to do is add the AutoTools Dialog action to your task. Populate the names with your home devices and assign commands to each option. These commands will be stored in a variable %atcommand. Once pressed, the variable will be set, and we can trigger the correct Join Push action. Each Join Push action will have a matching IF condition (%atcommand ~ home or work etc).

Chrome Dialog Profile

Profile: Chrome On PC
	Application: Chrome
	Event: Variable Value [ %FingerScanned eq 1 ]
Enter: Chrome Dialog
	A1: Secure Settings [ Configuration:AutoInput: service.ServiceAccessibility - Enabled Timeout (Seconds):0 ] 
	A2: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ] 
	A3: AutoInput UI Query [ Configuration:Only Visible: true
Only Clickable: false
App Package: com.android.chrome
Check Screen State: false
Text: ((?<=http:\/\/|https:\/\/|https:\/\/www.|http:\/\/www.|www.))?.*
Regex: true
Variables: address Timeout (Seconds):20 ] 
	A4: AutoTools Dialog [ Configuration:Dialog Type: List
Title: Select your pc
Icon: android.resource://net.dinglisch.android.taskerm/hd_hardware_dock
List Type: 0
Texts: Home,Work
Text Size: 20
Image Width: 100
Commands: home,work
Dim Background: true
Top Margin: 16
Bottom Margin: 16
Bottom Buttons Top Margin: 16
Bottom Buttons Bottom Margin: 16
Close On Select: true
Separator: ,
Command Variable: atcommand
Cancelable: true
Turn Screen On: true Timeout (Seconds):60 ] 
	A5: Join Send Push [ Configuration:Device: Chrome@Home
Url: %address Timeout (Seconds):60 ] If [ %atcommand ~ home ]
	A6: Join Send Push [ Configuration:Device: Chrome@work
Url: %address Timeout (Seconds):60 ] If [ %atcommand ~ work ]
	A7: Secure Settings [ Configuration:AutoInput: service.ServiceAccessibility - Disabled Timeout (Seconds):0 ] 


WhatsApp – Continue conversation on the PC

screenshot_20161204-151223Here’s a new one we’ve cooked up in the lab. Holding a Whatsapp conversation on your phone is great for quick back and forth messages, but sometimes you would rather hop on to your PC to type out longer responses. As such, I’ve created a very simplistic, yet very useful profile that will get WhatsApp’s online interface up and running on your PC so you could continue your conversation. If you have more than one PC, feel free to link this to a WiFIi Connected context or create a dialog like we did in the previous example.

WhatsApp Profile

Profile: WhatsApp On PC
	Event: Variable Value [ %FingerScanned eq 1 ]
	Application: WhatsApp
Enter: Whatsapp
	A1: Join Send Push [ Configuration:Device: Chrome@Home
Url: https://web.whatsapp.com/ Timeout (Seconds):60 ] If [ %Location ~ home ]
	A2: Join Send Push [ Configuration:Device: Chrome@work
Url: https://web.whatsapp.com/ Timeout (Seconds):60 ] If [ %Location ~ work ]


Facebook – Open Facebook on a PC

screenshot_20161204-151227In a very similar fashion, we can continue our Facebook browsing on our PC if you’re getting tired of scrolling your feeds on your mobile device. In the same way as before, we’ll point our PC to the URL of Facebook’s desktop site via a Join push. Of course, feel free to again modify this by adding a WiFi Connected context or a dialog for multiple devices.

Facebook Profile

Profile: Facebook On PC
	Event: Variable Value [ %FingerScanned eq 1 ]
	Application: Facebook
Enter: Facebook
	A1: Join Send Push [ Configuration:Device: Chrome@Home
Url: https://www.facebook.com/ Timeout (Seconds):60 ] If [ %Location ~ home ]
	A2: Join Send Push [ Configuration:Device: Chrome@work
Url: https://www.facebook.com/ Timeout (Seconds):60 ] If [ %Location ~ work ]


Maps – Navigate home, or to your favorite location

A one click ‘Take me home’ button can save some time and frustration, especially when you’re in a hurry. Although you can create a launcher shortcut to start Google Maps navigation, some users would prefer not to clutter their home screen with additional icons. When Google Maps is open, we can pass an intent to ask Google to take us home (requires the “Home” location in Google Maps to be set or a hard-coded address in the variable). If you wish to have a few favorites to choose from like ‘work’ or ‘Las Vegas’, we can also link a dialog.

Navigate Home

With a quick press of a button, an Intent action is sent. This will open Google Maps and set ‘home’ as your destination. Simple!

Maps Profile

Profile: Maps Go Home
	Event: Variable Value [ %FingerScanned eq 1 ]
	Application: Maps
Enter: Maps
	A1: Send Intent [ Action:android.intent.action.VIEW Cat:None Mime Type: Data:google.navigation:q=home Extra: Extra: Extra: Package: Class: Target:Activity ] 

Favorite Locations

screenshot_20161204-151503Create a dialog with AutoTools, and fill in a list of locations. You can use places like home or work, cities, or specific addresses. List them separated with commas. The AutoTools dialog will populate the variable %attext when the option is pressed. This option will be passed over to the intent, in the data field: google.navigation:q=%attext . The intent: android.intent.action.VIEW  will take you to your destination.

Maps Fav Profile

Profile: Maps Go Home 
	Event: Variable Value [ %FingerScanned eq 1 ]
	Application: Maps
Enter: Maps Dialog
	A1: AutoTools Dialog [ Configuration:Dialog Type: List
Title: Select location
Icon: app-icon:com.google.android.apps.maps
List Type: 0
Texts: Home,Work,Las Vegas
Text Size: 20
Image Width: 100
Dim Background: true
Top Margin: 16
Bottom Margin: 16
Bottom Buttons Top Margin: 16
Bottom Buttons Bottom Margin: 16
Close On Select: true
Separator: ,
Command Variable: atcommand
Cancelable: true
Turn Screen On: true Timeout (Seconds):60 ] 
	A2: Send Intent [ Action:android.intent.action.VIEW Cat:None Mime Type: Data:google.navigation:q=%attext Extra: Extra: Extra: Package: Class: Target:Activity ] 


Hangouts – Quick reply Templates

screenshot_20161204-151421I know I seem to love the AutoTools Dialog action, but that’s because it provides a very useful feature that can be applied in a wide range of Tasker scripts. In this case, we will use a dialog to quickly populate the clipboard with a quick-reply template. Once the selection is made, you can paste your text message or reply in seconds. No need for typing.

We will use an array to store our messaging templates in. To create an array, use Variable Set and list your options separated by a comma. You will then perform a Variable Split by the comma and will then be able to list the array in an AutoTools dialog! Make sure it is a global array (contains an upper case letter in the name) as local arrays will disappear. The AutoTools Dialog will take the %Templates() array in the text field and will populate your list with options. All you need to do now is use the Set Clipboard action to store the value of %attext.

To help you out, I kept the array actions for you in the description. Once you have create an array of template responses you can delete A1 and A2 actions from your task. If you wish to modify your template response array in the future, simply go to the ‘Variables’ tab in Tasker and look for the %Templates variable.

Hangouts Profile

Profile: Hangout Template 
	Event: Variable Value [ %FingerScanned eq 1 ]
	Application: Hangouts
Enter: Hangout (16)
	A1: [X] Variable Set [ Name:%Templates To:option 1, option 2, option 3 Do Maths:Off Append:Off ] 
	A2: [X] Variable Split [ Name:%Templates Splitter:, Delete Base:Off ] 
	A3: AutoTools Dialog [ Configuration:Dialog Type: List
Title: Select your template
Icon: android.resource://net.dinglisch.android.taskerm/hd_content_edit
List Type: 0
Texts: %Templates()
Text Size: 20
Image Width: 100
Dim Background: true
Top Margin: 16
Bottom Margin: 16
Bottom Buttons Top Margin: 16
Bottom Buttons Bottom Margin: 16
Close On Select: true
Separator: ,
Command Variable: atcommand
Cancelable: true
Turn Screen On: true Timeout (Seconds):60 ] 
	A4: Set Clipboard [ Text:%attext Add:Off ] 
	A5: Flash [ Text:Clipboard set to: %attext Long:On ] 


Camera – Delayed Shutter

screenshot_20161204-151245I always find it uncomfortable to use the camera for selfies. Scanning your finger to take a picture is perhaps not the greatest solution, however you can set a timer which will allow you to get your hand in position to take a much better picture.

To give ourselves a warning, the Android voice engine will count down for us with the action Say. After this – use the action Button – Camera to take the picture with the main camera. No need to play with the timers or reaching out for a button.

Camera Profile

Profile: Camera Seflie Main
	Event: Variable Value [ %FingerScanned eq 1 ]
	Application: Camera
Enter: Camera 
	A1: Say [ Text:In 3,2,1... Engine:Voice:com.google.android.tts:eng-gbr Stream:2 Pitch:6 Speed:6 Respect Audio Focus:On Network:On Continue Task Immediately:Off ] 
	A2: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ] 
	A3: Button [ Button:Camera ] 


YouTube – Cast video to PC

screenshot_20161204-151324Owning a smart TV has made me realize that casting a YouTube video to a PC is unnecessarily difficult. Unless your PC has the YouTube page open in a TV mode, the cast option is not available. Fortunately, we can enable the option using the fingerprint scanner. This is yet another simple, but useful profile. All we will be doing is opening the YouTube TV page on our PC via Join Push, and you can then cast your current video to your PC! So simple!

YouTube Profile

Profile: Youtube PC (21)
	Event: Variable Value [ %FingerScanned eq 1 ]
	Application: YouTube
Enter: Youtube (20)
	A1: Join Send Push [ Configuration:Device: Chrome@Home
Url: https://www.youtube.com/tv Timeout (Seconds):60 ] 


Fingerprint Sensor Alternative

screenshot_20161204-151206If you don’t have a sensor, the same behavior can be reproduced with an overlay, by making an invisible scene that will act exactly the same way as scanning your finger. Place it in a fixed location, so you would know where to tap (or long tap) and execute the following:

Scanned Finger
	A1: Variable Set [ Name:%FingerScanned To:1 Do Maths:Off Append:Off ] 
	A2: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ] 
	A3: Variable Set [ Name:%FingerScanned To:0 Do Maths:Off Append:Off ] 

You can make the button visible, but I found it a little distracting especially when watching videos.  Select all applications that would support the use of the button by creating a profile which will show and destroy the scene.

Fake button

Profile: Fake Button
	Application: Chrome, Camera, Hangouts...
Enter: Fake Button 
	A1: Create Scene [ Name:Fake Finger ] 
	A2: Show Scene [ Name:Fake Finger Display As:Overlay, Blocking Horizontal Position:200 Vertical Position:100 Animation:System Show Exit Button:On Continue Task Immediately:On ] 

Exit: Fake Button-
	A1: Destroy Scene [ Name:Fake Finger ] 


You can download the entire Project by following the download link below. After downloading the Project XML file, you can import it by opening up Tasker then long-pressing on the Home icon at the bottom left. This will bring up the Tasker Project menu, which will allow you to import Projects located on the internal storage.

Download the Context Aware Fingerprint Reader Project

I’m keen to see what other uses you could come up with. Let me know and I will update this post.

Discuss This Story

READ THIS NEXT