Enable/Disable in USB Programmatically: Android

89 views Asked by At

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...

0

There are 0 answers