Memory-Assistant
Memory-Assistant copied to clipboard
Environment.getExternalStorageDirectory is deprecaterd and needs to be replaced with Storage Access Framework
Environment.getExternalStorageDirectory
has been deprecated in Android Q. It should stop working in Android R. This is done to ensure privacy.
The new alternative for File handling is the Storage Access Framework
.
https://github.com/baldapps/Flipper
is a library that helps in keeping the old behaviour and can be tried.
@shetyeanuja can you mention the resolving commit in this thread
Instead of Helper.APP_FOLDER
directory for saving the file, we can use getFilesDir()
//After API 23 permission request is asked at runtime
int EXTERNAL_STORAGE_PERMISSION_CODE = 23;
//Requesting Permission to access External Storage
ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
EXTERNAL_STORAGE_PERMISSION_CODE);
//It creates an app-specific directory, hidden from users and deleted with the app
File folder = getActivity().getFilesDir();