마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

API 29 지원하지 않는 코드 대체코드 좀 알려주세요ㅠㅠ

0 추천

API 29버전을 사용하는 도중 더이상 지원하지 않는 함수가 있습니다. 이 함수들의 대체코드를 작성하여 구현하고 싶습니다. 도와주세요ㅜㅜㅜ 

getExternalStorageDirectory()

냥냥냥 (160 포인트) 님이 2020년 9월 27일 질문
해당 API 문서를 참조하시면 deprecation시에 대체할 함수가 나옵니다.

https://developer.android.com/reference/android/os/Environment

getExternalStorageDirectory()
This method was deprecated in API level 29. To improve user privacy, direct access to shared/external storage devices is deprecated. When an app targets Build.VERSION_CODES.Q, the path returned from this method is no longer directly accessible to apps. Apps can continue to access content stored on shared/external storage by migrating to alternatives such as Context#getExternalFilesDir(String), MediaStore, or Intent#ACTION_OPEN_DOCUMENT.
Apps can continue to access content stored on shared/external storage by migrating to alternatives such as Context#getExternalFilesDir(String) , MediaStore, or Intent#ACTION_OPEN_DOCUMENT.
앱이 계속 공유/외부 저장공간에 접근하려면 대체 함수인  Context#getExternalFilesDir(String나 MediaStore, oIntent#ACTION_OPEN_DOCUMENT 와 같은 방법을 사용하라고 하네요.

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...