0

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)?

1 Answers1

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

Community
  • 1
  • 1
Nir Duan
  • 6,164
  • 4
  • 24
  • 38