I'm using MOTO G3 phone(Android Device). I wanted to get all PDF files list from my phone. I have followed this tutorial. http://kalisandroid.blogspot.in/2015/01/load-pdf-files.html . I got nothing. But when the same program is run in SONY phone it is displaying the files what was the actual problem. ow to resolve this problem ( i have written Android Manifest permissions also)?
Asked
Active
Viewed 62 times
0
-
What OS versions are the 2 phones? Is one pre-KitKat? – Gabe Sechan Jul 24 '16 at 16:04
-
sony is kitkat(4.4.2) versio ,moto g3 version is Marshmallow – satish potnuri Jul 24 '16 at 16:06
-
THey changed legal access to the external card on KitKat. You can only read certain directories, not the entire disk unless you have root access. – Gabe Sechan Jul 24 '16 at 16:09
-
but nothing is displayed .can i get some code for this?? – satish potnuri Jul 24 '16 at 16:10
1 Answers
0
Call this at runtime:
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, REQUEST_CODE);
Do your code here:
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if(grantResults[0]== PackageManager.PERMISSION_GRANTED){
Log.v(TAG,"Permission: "+permissions[0]+ "was "+grantResults[0]);
//resume tasks needing this permission
}
}
For both version support code read this
For additional information on the subject read this