SHARE
TWEET

Untitled

a guest Aug 25th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public boolean isStoragePermissionGranted(){
  2.         if (Build.VERSION.SDK_INT >= 23) {
  3.             if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED){
  4.                 Log.v("LOG", "Permission granted");
  5.                 return true;
  6.             } else {
  7.                 Log.v("LOG", "Permission revoked");
  8.                 ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
  9.                 return false;
  10.             }
  11.         }else{
  12.             Log.v("LOG", "Permission is granted");
  13.             return true;
  14.         }
  15.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top