in my application i want to enable / disable the USB connection in the phone or tab(Android based) programmatically.I googled , but did not find any solution.If it is possib
This is possible, but your application should own the device, by owning the device you can use the DevicePolicyManager.addUserRestriction method, as follows:
DevicePolicyManager devicePolicyManager =
(DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
if (devicePolicyManager != null && isDeviceOwnerApp(context)) {
devicePolicyManager.addUserRestriction(componentName, UserManager.DISALLOW_USB_FILE_TRANSFER);
}