Android device Storage
데이터 사용에 따라 안드로이드 디바이스 저장소는 크게 4개로 이루어져있다.
https://developer.android.com/training/data-storage
데이터 및 파일 저장소 개요 | Android Developers
DataStore offers a more modern way of storing local data. You should use DataStore instead of SharedPreferences. Read the DataStore guide for more information. 이 페이지는 Cloud Translation API를 통해 번역되었습니다. 데이터 및 파일 저
developer.android.com
1. Internal Storage
2. External Storage
3. DataStore (or Shared Preference)
4. SQLite (table 형식으로 db 저장)
1. Internal Storage(내부저장소)
- 경로: /data/data/패키지명/files/내가 지정한 파일명
- 기본적으로 안드로이드 디바이스에서 제공하는 저장소
- 보안으로 인해 외부에서 접근이 불가하다
- 앱 삭제 시, 데이터도 삭제됨 (스토리지 경로가 아예 지워진다.)
2. External Storage(외부 저장소)
- 외부라는 이름때문에 헷갈릴 수 있지만, 외부에 있어서 외부 저장소라 부르는게 아님. 내장메모리형 SD 카드로 생각하면 된다.
- 보통 Storage로 경로가 시작된다. Storage/emulated/0/Android/data/앱 전용폴더(패키지명)/files
- 보안으로 인해 외부에서 접근이 불가하다. 갤럭시 - 내파일에서 확인 가능함.
- 앱 삭제 시, 데이터도 삭제됨
3. Preference
shared preference는 xml형식으로 내부 저장소에 저장된다.
(최근에는 DataStore로 권장. DataStore는 지정한 파일명.확장자로 저장된다.)
4. SQLite
모바일 전용 DBMS인 SQLite를 이용해 안드로이드 안에서도 테이블을 만들어 db를 저장할 수 있다.
내부 저장소에 저장된다.