2

For Enable/Disable USB progrmatically, first I rooted device. Now I have root access. And I attempted below function

IBinder service = ServiceManager.getService("mount");
IMountService mMountService = IMountService.Stub.asInterface(service);

and For Enable/Disable

mMountService.setMassStorageEnabled(true);
mMountService.setMassStorageEnabled(false);

But when I am attach USB cable to device, it prompts Turn on USB dialog and can transfer data between PC and USB
storage. How to stop USB in device.??

OR

Is it possible using Android NDK??

Any help would be helpful to me. Thank you...

user1134427
  • 111
  • 1
  • 8
  • You cannot mount or unmount USB, unless your application is part of the firmware,with public api. There is a non public API, `StorageManager.disableUsbMassStorage();` not sure how effective, havent tried it – Vrashabh Irde Dec 17 '13 at 09:48

0 Answers0