Android的意图打开"海量存储活性QUOT;海量、活性、意图、Android

2023-09-07 18:06:21 作者:念他成瘾

我需要从我的应用程序中打开USB大容量存储设备的活动。

I need to open USB Mass Storage Activity from my application.

是否有任何意图来做到这一点?

Is there any Intent to do this?

startActivity(新意图(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS))

推荐答案

您可以尝试使用以下内容:

You can try to use following:

苏-c setprop sys.usb.config<指挥GT;

完全可以通过这一个命令来找到列表:结果猫init.usb.rc

Full list of can be found by this one command: cat init.usb.rc

功能才能够从应用程序运行命令:

Function to be able to run command from app:

   public void RunAsRoot(String[] cmds){
            Process p = Runtime.getRuntime().exec("su");
            DataOutputStream os = new DataOutputStream(p.getOutputStream());            
            for (String tmpCmd : cmds) {
                    os.writeBytes(tmpCmd+"\n");
            }           
            os.writeBytes("exit\n");  
            os.flush();
}