HomeTaskerTasker: Set USB for file transfer automatically

Tasker: Set USB for file transfer automatically

Just plug and play, I mean enjoy your USB drive access

I have been shooting more and more videos with my Pixel 3 recently which means that all these files have to go somewhere. I acquired a USB-C expansion card to my PC to speed up the transfer process (review is coming). There was one thing left to make the process quicker and less painful: using Tasker to set USB for file transfer automatically.

Set USB for file transfer automatically with Tasker

The way Android storage is accessed via PC has changed over the years. It was much easier (and less secure in the past) now, the default way is simply annoying. I appreciate the security as any other guy, but c’mon Android, you could do it better! It was time to do what I’m doing best and use Tasker to set USB for file transfer automatically.

As soon as the Nav Bar Action has been released, I knew I would use this for that purpose. Android 9.0 is perfect for the nav bar modifications as it leaves a lot of space in the right corner. With the plan in mind, it was time to shape up Tasker’s behaviour.

You will need the following plugins to make it happen:


Since I’m going to use AutoNotification plugin anyway, I opted out for notification monitoring rather than the USB trigger as an option. This way I only going to enable, then a correct device is plugged in.

When the notification is preset, Tasker will show me an extra navbar button which will:

  • [tap once] enable file sharing
  • [tap two] close the option

It’s possible to add the third tap, but I barely use any options. If you wish you can add the task to trigger MIDI, PTP or USB tethering.

I will need two actions, one to create the navbar button, and one to restore the original navbar button.

Action: Set USB for file transfer automatically

TASKER TASK: USBFS Set File transfer
USBFS Set File Sharing
	A1: AutoNotification Actions 
		[ Configuration:Notification Title: 
		  Charging this device via USB Timeout (Seconds):20 ] 
	A2: AutoTools Secure Settings 
		[ Configuration:Set Accessibility Services: true
		  Accessibility Services: com.joaomgcd.autoinput/com.joaomgcd.autoinput.service.ServiceAccessibility 
		  Timeout (Seconds):60 ] 
	A3: AutoInput Action 
		[ Configuration:Type: Text
		  Value: File transfer
		Action : Click Timeout (Seconds):20 ] 
	A4: [X] Keyboard [  Input:Tab Time Between Inputs:50 ] 
	A5: [X] Keyboard [  Input:Tab Time Between Inputs:50 ] 
	A6: [X] Keyboard [  Input:Tab Time Between Inputs:50 ] 
	A7: [X] Keyboard [  Input:Enter Time Between Inputs:50 ] 
	A8: Navigation Bar [ Left:back[1.0] Center:home[1.0] Right: ] 
	A9: AutoTools Secure Settings 
		[ Configuration:Set Accessibility Services: true 
		  Timeout (Seconds):60 ] 
	A10: Go Home [ Page:0 ]

Initially, I wanted to use the new Keyboard action to toggle between on-screen options, but the method was much slower than AutoInput. If you don’t want to use AutoInput (I’m going to use AutoTools to enable and disable the accessibility services to avoid the lag) you can use the keyboard action. It is slow.

To access the USB preferences screen, I’m using AutoNotification Action. This way I can simply “tap” on the message in my notification drawer which will open the correct setting’s menu.

Keyboard action way
To access the correct setting, you have to perform 4 actions:

  • Tab
  • Tab
  • Tab
  • Enter

Keep the delay to min  (50). 

First, enable the AutoInput accessibility using AutoTools Secure Settings, then using AutoInput automated setup navigate to the setting screen and tap on your preferred option. Return to the notification created by the AutoInput and finish up the task.

Since the AutoInput is no longer needed, toggle it back to off with AutoTools Secure Settings and modify the navbar to default values. Lastly, for the clean effect, navigate to the home screen.

Putting it back together

Once you can set USB for file transfer automatically, add the task to the navbar action when prompted to add another, link the task responsible for resetting the navbar to the default state and you are ready to go.

Smart NavBar integration

This is a stand-alone version of the Smart NavBar actions. Once I created the standalone versions for each NavBar Task I will show you how to integrate it together. You can read the tutorial about this now!


I should have set this up much sooner if I’m honest. It was easier than expected with AutoNotificaiton, and thanks to the AutoTools toggles AutoInput is not running constantly. Now I can set USB for file transfer automatically. It’s not a flashy profile, but something tells me it will be one of the most useful ones for sure.

Project Download

Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.


Nothing says "Thank you" better than keeping my coffee jar topped up!


Support me on Patreon and get an early access to tutorial files and videos.


Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

New to Tasker?

Tasker Quick Start – Getting started with Tasker

From newb to not so newbie in 10 min

Best Tasker Projects

How to use Raspberry PI as WOL (wake on lan) server

While you could wake up your PC from a mobile directly, having a dedicated server capable of doing so is the best solution. The reason is simple. You can hook up as many devices as you wish with a single endpoint. This is why Raspberry Pi is perfect for this.

How to wake on LAN computers and put it to sleep with Power Menu,...

How to Wake on LAN properly via Android, Alexa, Google Assistant and Web

7 awesome Bluetooth keyboard shortcuts for Android

7 unique Android shortcuts that you can add to any Bluetooth keyboard.

Smart overnight charging with Tasker

Still keeping your phone plugged in overnight? Try smarter overnight charging with this profile

One thing that Join app can’t do and how to fix it with Tasker

It's not possible to share the clipboard automatically between join accounts registered to 2 different emails. But you can fix this with tasker.

Essential Guides

Tasker: Seconds into DD:HH:MM:SS (dynamic)

It's time to.... ok it's a pun, but I will show you how to master time and convert seconds to DD:HH:MM:SS dynamically

4 ways to organise Tasker projects

Keep your Tasker tidy!

A better way to store Tasker credentials

The more clever way of managing credentials

Annoyed with dozens of AutoApps populating your app drawer? Here is a fix!

Clear your app drawer from the clutter in seconds

Putting AutoTools pie chart to a good use – SSID logger

Who wants a piece of the pie (chart)?