Tasker: Set USB for file transfer automatically
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 plugns 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
Initially, I wanted to use the new Keyboard action to toggle between on-screen options, but the method was much slower than AutoInput. (UPDATE: Joao corrected me, all the Tab and Enter keys can be entered as a single action which will speed things up). 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.
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.
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.
You can download the files from this link. If you like my work, you can always buy me a coffee via PayPal, or join Patreon to gain additional rewards including early access to files and videos.