How to avoid application autostart when a usbdrive is plugged to tablet When I plug a USB drive to my Samsung tablet (using USB connection kit), my Android 4.0.4 automatically starts the Archive application, in order to see which is the content of the pen drive. The same happens with an application that I wrote, Android popup a message to match plugged device with my application.
Is it possible to avoid this autostart? How?
Thanks
Why are there any apps starting when the drive is attached?
First you need some background information what's going on there. Many things on Android are &quot;event-based&quot;. That is, when &quot;something&quot; happens, the system issues a &quot;broadcast&quot; saying so. Some well-known and easy-to-understand events include

boot completed
storage (un)mounted (usually sdcard removed/inserted, or some external drive)
battery low
network changed

Apps can register &quot;listeners&quot; for specific broadcast-events (intents), so they get started/awakened/informed then. Again some examples:

media-scanner wants to know when a new storage &quot;entity&quot; got attached, to check for music/pictures/videos to insert into its internal database
location service wants to know about network changes: if there's a new network, it might be interesting to determine the current location
several apps (far too many) want to start at boot

So obviously, your Archive app has registered a listener for the storage broadcast, and similarly your app.
How to get rid of that?
For your own app, you could adjust its code correspondingly. But that's no task for us here, but if needed, you can discuss that at our sister-site stackoverflow.com.
For all other apps (the following is applicable to other combinations as well), you will need your device to be rooted (details can be found in the rooting tag-wiki). Then go to the playstore and get yourself an app like e.g. Autorun Manager PRO (yes, for the following you will need the Pro if you decide for this app. I chose it nevertheless, as it turned out to be the best in my tests a while ago):

AutoRun Manager (click image to enlarge)
As you can see in the screenshot, AutoRun Manager permits you to disable each listener an app may have registered separately. And their names are (in most cases) quite descriptive. So use ARM, go into its &quot;Advanced Mode&quot;, look up the Archive app, and check what listeners it has registered. Disable the one sounding reasonable -- and your issue should be solved.
You can change that anytime you want. Whenever the modified app is updated, you will have to do that again. You also can simply revert all changes with two taps, as ARM has a specific &quot;restore&quot; feature for that.

PS: As you have tagged your question auto-start, you could have hovered your mouse over that tag, and select the &quot;info&quot; link. This will bring you to the tag wiki, where you can find most of what I just wrote (and maybe even some additional information) -- so I recommend reading that as well. Furthermore, take it as hint for the future: Many of our tag-wikis contain first-aid. And in many cases that might already be enough to solve an issue :)