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

  • Try following the instructions here to remove it as a default application, not sure if it works with OEM apps though: android.stackexchange.com/questions/17128/… – Peanut Apr 4 '13 at 15:20
  • 1
    That won't help if there's only one app installed for the purpose, as that would become the "default app" nevertheless. And even if there were no default app (but still app(s) listening on the "plug event"), then a popup would appear to select an app. If I understand correctly, nothing shall be opened when the drive gets attached (correct me if I'm wrong, Ant4res). – Izzy Apr 4 '13 at 15:35
  • @Izzy Yes, you're right, nothing shall be opened when the drive gets attached. Is there a way to avoid the popup appears? – Ant4res Apr 4 '13 at 19:10

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 "event-based". That is, when "something" happens, the system issues a "broadcast" 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 "listeners" for specific broadcast-events (intents), so they get started/awakened/informed then. Again some examples:

  • media-scanner wants to know when a new storage "entity" 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 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
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 "Advanced Mode", 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 "restore" feature for that.

PS: As you have tagged your question , you could have hovered your mouse over that tag, and select the "info" 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 :)

| improve this answer | |
  • Thanks for your answer! I solved the problem with my application, but there is a way to prevent android to show a popup requesting permission to access the usb device (the "use as default setting for this usb device" message)? – Ant4res Apr 5 '13 at 7:18
  • No idea. I have not yet used any external storage other than microSD cards. // Btw: if my answer helped you, why not upvoting/accepting? :) – Izzy Apr 5 '13 at 7:21
  • Always glad to help -- thank you! As for your USB drive message: You might try to google the complete message which pops up (enclodes in quotation marks), that might turn up something useful. – Izzy Apr 5 '13 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.