In a library, I want to return a file that represents App own directory in External Storage, the directory that is returned by this method:
context.getExternalFilesDir(null);
But using this method before API Level 19, needs WRITE_EXTERNAL_STORAGE
permission and I do not want to force user to use this permission, specially my method only want to return abstract File and does not want to create directory.
I can use this code:
Environment.getExternalStorageDirectory().getCanonicalPath() + "/Android/data/" + packageName + "/files";
But I think hard coding is not safe.Is there a way to return that directory without forcing user to use WRITE
permission?
If you want to avoid the hard coded string, you could try to use reflect.