title: Is it possible to Turn Off USB Storage on Android Devices programatically?
body: <p>I have tried to search over and over and got confused whether we can have control over USB storage without rooting the phone,if yes than how? I have tried the following method to enable and disable the permission but all in vain:</p>
  
  <pre><code>StorageManager storage = (StorageManager)getApplicationContext().getSystemService(STORAGE_SERVICE);
   Method method = storage.getClass().getDeclaredMethod("enableUsbMassStorage");
   method.setAccessible(true); 
   Object r = method.invoke(storage);
  
  //And to disble mass storage:
  
  StorageManager storage = (StorageManager) getApplicationContext().getSystemService(STORAGE_SERVICE);
  Method method = storage.getClass().getDeclaredMethod("disableUsbMassStorage");
  method.setAccessible(true);
  Object r = method.invoke(storage);
  </code></pre>
  
  <p>If anyone has any idea about this please do share your knowledge.</p>
  
  <p>Thanks in advance.</p>