Activity act = ... if (act.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { Toast.makeText(getContext(), "Permission is granted", Toast.LENGTH_LONG).show(); }else{ Toast.makeText(getContext(), "Permission is not granted", Toast.LENGTH_LONG).show(); ActivityCompat.requestPermissions(act, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1); }
ref : https://toepic.fail/안드로이드-마쉬멜로우-버전-이상에서-권한처리하기-95527b99aafb
댓글
댓글 쓰기