Closed abdullah230695 closed 3 years ago
after selecting the image , when I touch download icon it says "Failed to save image" as a snackBar, the image is not getting saved in gallery.
Can you please share the stack trace of the error.
yes see this, Im getting the result in OnFailure method
The log says : java.io.FileNotFoundException: /storage/emulated/0/Pictures/1620045395282.png.jpg: open failed: EACCES (Permission denied)
Seems like you did not allow storage permission for the app. Please check and allow the storage permission for the app on setting.
actually it doesn't ask for write permission when touching download icon and also its not showing storage option in app settings. so I just removed " maxSdkVersion=28 " from manifest now its showing storage permission in app settings and I just enable it manually now its working . I can able to save image. but the problem is its not asking for write permission at first...
To ask permission I just added the permission this code if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.M) { if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) { String[] permission = {Manifest.permission.WRITE_EXTERNAL_STORAGE}; requestPermissions(permission, WRITE_EXTERNAL_STORAGE_CODE); } }
Anyway you have built a nice project Thankyou so much
@tanoDxyz Do you have any input on this ?
well if @abdullah230695 is running the code on emulator than there is a slight chance that correct code will cause the problem .
second the only thing that came up in my mind while seeing this error is that if requestLegacyExternalStorage
is used in conjuction with android device that is running android 10 or above - it will cause such error.
any additional info :>