title: How to turn off USB mass storage programmatically in Android?
body: <p>I want to turn on/off the USB mass storage in Android.</p>
  
  <p>I tried the below code. It's not working. Can any one please help me in this?</p>
  
  <p>To disable the Mass storage I have used this:</p>
  
  <pre><code>Settings.Secure.putInt(getcontentResolver(),Settings.Secure_MASS_STORAGE_ENABLED,0)
  </code></pre>
  
  <p>To enable the Mass storage I have used this:</p>
  
  <pre><code>Settings.Secure.putInt(getcontentResolver(),Settings.Secure_MASS_STORAGE_ENABLED,1)
  </code></pre>
  
  <p>The code above is not working though. Am I need to pass any intent for this?</p>