I try to add a Bitmap
photo that I took with the phone to the gallery in Android Studio but I am getting the error:
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()
I have used in the Manifest xml:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="21"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="21" />
The way I save the image is:
MediaStore.Images.Media.insertImage(getContentResolver(), FullBitmap, "Name" , "Date");
I am using the Nexus 5 emulator and Android version 5.1.