-
-
Notifications
You must be signed in to change notification settings - Fork 992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permission denied while it Allowed! access to external storage problem #226
Comments
Yes. I am aware of it. If would be really great if you can help to raise a PR for Android 10 storage support |
FWIW, I was able to save it to the DCIM folder in a custom app I'm writing.
I also added a media scan in the onSuccess method so the new file shows up immediately in the gallery apps
I then pass on the imageUri back to the calling activity where in onActivityResult I ask for permissions so the app can read/write the newly written file:
Hope that might help a bit. |
thanks, @swentel, @burhanrashid52 |
I just Opened PR about this Issue, <application
android:name="com.burhanrashid52.photoeditor.PhotoApp"
........
android:requestLegacyExternalStorage="true">
File file = new File(Environment.getExternalStorageDirectory()
+ File.separator + ""
+ System.currentTimeMillis() + ".png"); with final File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
System.currentTimeMillis() + ".png"); then add this method //added the photo file to gallery
private static void galleryAddPic(Context context, String imagePath) {
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
File f = new File(imagePath);
Uri contentUri = Uri.fromFile(f);
mediaScanIntent.setData(contentUri);
context.sendBroadcast(mediaScanIntent);
} call the method after in saved @Override
public void onSuccess(@NonNull String imagePath) {
...........
mPhotoEditorView.getSource().setImageURI(mSaveImageUri);
galleryAddPic(EditImageActivity.this, file.getAbsolutePath()); <-- here
} I hope this helps someone |
@breel93 Thanks bro. Helped a lot :D |
Hi.. i'm still experiencing permission denied... while permission is already given in manifest... and also tried solution above but.. still permission is denied |
check whet
check whether u give permission to access storage from mobile setting for this app.. |
Fixed in #326 |
I tried the sample app on Android 10 (AVD virtual device), and it failed to saving photo on device, "permission denied", while I Allowed it.
I search and found that this deprecated function is the problem.
PhotoEditor/app/src/main/java/com/burhanrashid52/photoeditor/EditImageActivity.java
Line 266 in e94dd4b
I replace it with:
File file = new File(this.getExternalFilesDir(DIRECTORY_PICTURES) + File.separator + "" + System.currentTimeMillis() + ".png");
and it works fine, but it save photo in app private folder.
there are some workaround solutions, but I didn't use it.
The text was updated successfully, but these errors were encountered: