Android Intent to open “Mass Storage Activity”

百般思念 提交于 2019-12-10 13:30:25

问题


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

Is there any Intent to do this?

something like

startActivity(new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS))


回答1:


You can try to use following:

su -c setprop sys.usb.config <command>

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();
}


来源:https://stackoverflow.com/questions/8652917/android-intent-to-open-mass-storage-activity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!