I want my application load a file with File Chooser. I'd tried some modules to implements it, but strangely my KitKat rooted phone, and unrooted earlier version can read directories and files inside storage, but for unrooted KitKat version cannot read anything inside the storage.
Here's some module I tried and the code I used :
Intent intent = new Intent(this, FileChooser.class);
ArrayList<String> extensions = new ArrayList<>();
extensions.add(".csv");
intent.putStringArrayListExtra("filterFileExtension", extensions);
startActivityForResult(intent, 0);`
Intent intent = new Intent(this, FileChooserActivity.class);
intent.putExtra(FileChooserActivity.INPUT_START_FOLDER, Environment.getExternalStorageDirectory());
intent.putExtra(FileChooserActivity.INPUT_REGEX_FILTER, ".*csv|.*CSV");
this.startActivityForResult(intent, 0);
Also, here's the permissions I used inside AndroidManifest
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
No errors found, only when I access the storage, nothing can be shown, but when I access root directory, it seems normal in every phone.
Is there any way to fix this or better library / modules which is support the recent version of Android ?
EDIT FOR SOLUTION : Thanks to Ish, the attribute android:maxSdkVersion can make my application goes on trouble. It should be not using that attribute. The codes are okay