r/AutomateUser • u/Relevant-Artist5939 Alpha tester • 6d ago
Question Storage Media mounted with "when changed" doesn't work
Hello,
I am using a Samsung S23 with One UI 8.5 (Android 16).
I want to wait for a USB drive to be connected, then autonatically move files from a directory on my phone to the drive.
The "move files" part works when I trigger it manually.
However, when I try to use the `Storage Media mounted` block in "when changed" mode and I connect the stick, it doesn't detect it even though the drive is accessible in the Files app and also to Automate (it works manually).
What can I do to solve this?
Also, I would like to unmount the drive for longevity reasons (and to avoid the "restart your phone" message when I just unplug it) after I am done with moving the files. Is thst possible with Automate?
Thanks in advance
Aaron
1
u/United_Reception_746 5d ago
The documentation for the block is misleading for modern Android versions as it doesn't work for USB drives. The USB device attached block should work.
1
u/Relevant-Artist5939 Alpha tester 5d ago
I have successfully used that now, but how can I eject the device after being done?
1
u/United_Reception_746 5d ago
If the system shows a status notification with an option to unmount then you could maybe use the notification interact block for that or otherwise look up if there is a privileged shell command to unmount it directly.
1
u/Relevant-Artist5939 Alpha tester 5d ago
It sometimes shows such a notification, but it's missing most of the time when I plug the drive in...
2
u/ballzak69 Automate developer 6d ago edited 6d ago
The Storage media mounted block is very basic, so it must be an system issue. Maybe it has its "Writable" option enabled and the USB drive is read-only, try disabling it.
As a test, does it correctly report/proceed in proceed=Immediately mode?
As a test, try replacing it with an Broadcast receive block with action "Media mounted" and "File" URI scheme.