Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to navigate to android USB Mass Storage Activity?

I would like to get USB Mass Storage activity to turn on or off the usb mode when device is connected to pc.I have implemented an application as follows.

public class USB_ConnectActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    final String state = Environment.getExternalStorageState();
    ((Button)findViewById(R.id.onButton)).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            if (!(Environment.MEDIA_SHARED.equals(state))) {

                //How to navigate android USB Mass Storage page

            }
        }
    });


    ((Button)findViewById(R.id.offButton)).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            if ((Environment.MEDIA_SHARED.equals(state))) {

                //How to navigate android USB Mass Storage page

            }

        }
    });

        }
   }

from the above code I have used two buttons for turn off and on usb mass storage.But I don't have more information about it to navigate android in built USB Mass Storage page. Please any body help me.

like image 656
prasad.gai Avatar asked Jun 05 '12 07:06

prasad.gai


People also ask

Where is USB mass storage on Android?

Enable mass storage is very easy, you can check the settings in android devices to do it. Just go to Settings > Wireless and Network > USB Utilities > Connect storage to PC.

What is USB mass storage mode?

A standard that allows many newer phones with USB connections to transfer files between the phone and a PC without any special drivers or software on the PC. See: USB. In mass storage mode, the phone appears as a disk on the computer when connected via USB, just like a keychain USB flash drive.

How do I change USB connection mode from MTP to mass storage?

Here are some examples of how to set various Android devices to MSC mode. To set the Motorola Atrix to USB Mass Storage (MSC) mode, drag the status bar down and tap on "USB connection". Then tap on "USB Mass Storage" and then "OK".


2 Answers

If you only want to launch the USB mass storage Activity, then your question is an exact duplicate of: Android Intent to open "Mass Storage Activity" and should be closed.

If you actually want to change the status of the USB mode, which is what it looks like, then this isn't a duplicate (as far as I can tell), but the answer is still: you can't do it.

Maybe there's a better way, but when I want to know what Intents are available for launching system Activities, I look at the Android SDK documentation for Intent and search for "activity action". That shows you many system Activities you can launch, such as the "battery use" Activity and the uninstallation Activity. There's nothing there showing the USB mode Activity as a public Intent. Excusing the pun, this was probably intentional.

And there's certainly no documentation I can find about any way to programmatically turn USB mode on or off, and this is also presumably intentional.

like image 116
Darshan Rivka Whittle Avatar answered Oct 22 '22 02:10

Darshan Rivka Whittle


This is not possible from the Android SDK.

like image 39
Vipul Avatar answered Oct 22 '22 02:10

Vipul