问题
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