title: Save photos to Android Gallery
body: <p>I try to add a <code>Bitmap</code> photo that I took with the phone to the gallery in Android Studio but I am getting the error:</p>
  
  <pre><code>Failed to insert image
     java.lang.SecurityException: Permission Denial: writing com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=4110, uid=10058 requires android.permission.WRITE_EXTERNAL_STORAGE, or grantUriPermission()
  </code></pre>
  
  <p>I have used in the Manifest xml:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="21"/&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="21" /&gt;
  </code></pre>
  
  <p>The way I save the image is:</p>
  
  <pre><code>MediaStore.Images.Media.insertImage(getContentResolver(), FullBitmap, "Name" , "Date");
  </code></pre>
  
  <p>I am using the Nexus 5 emulator and Android version 5.1.</p>