외부 저장소에 쓸 수있는 권한이 필요합니다. 새 API를 사용하려면 manifest
에 권한을 선언하고 런타임 중에 권한을 요청해야합니다.
// Here, thisActivity is the current activity
if (ContextCompat.checkSelfPermission(thisActivity,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(thisActivity,
Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
// Show an explanation to the user *asynchronously* -- don't block
// this thread waiting for the user's response! After the user
// sees the explanation, try again to request the permission.
} else {
// No explanation needed, we can request the permission.
ActivityCompat.requestPermissions(thisActivity,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
// MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE is an
// app-defined int constant. The callback method gets the
// result of the request.
}
}
당신은 자세한 내용은이 링크를 확인하실 수 있습니다
: https://developer.android.com/training/permissions/requesting.html
당신이 매니페스트의 권한 부분을 게시 할 수 있습니까? – FWeigl
@Ascorbin 거기에 권한이 없습니다, 응용 프로그램은 새로운 API를 적어도 필요가 없습니다. 어떤 권한을 구현해야합니까? – JDoeDoeDoeJ