ContentProvider 학습: 시스템 연락처 접근 및 커스텀 Provider 구현#25
Merged
Conversation
- `shipment.db` 데이터베이스를 추가한다.
- UriMatcher를 사용하여 URI에 따라 다른 작업을 수행한다. - AUTHORITY와 CONTENT_URI를 정의하여 외부 앱에서 ContentProvider에 접근할 수 있도록 한다.
- 앱 실행 시 `logContacts()`를 호출하여 연락처 정보를 로그로 출력한다. - `READ_CONTACTS` 권한이 없는 경우 사용자에게 권한을 요청한다. - 기존 Shipment 데이터가 중복으로 쌓이지 않도록 `insertInitialShipments()` 호출 전에 데이터를 삭제하도록 수정한다.
- `ContactsActivity`를 추가하여 기기의 연락처 정보를 읽어와 화면에 표시 - `READ_CONTACTS` 권한 요청 및 처리 로직 구현 - `ContentResolver`를 사용하여 `ContactsContract`에서 연락처 이름과 전화번호 조회 - 기존 `ShipmentActivity`에서 연락처 관련 로직 제거
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. 시스템 ContentProvider 실습 - 연락처 조회
ContactsActivity추가ContactsContract.Contacts.CONTENT_URI를 사용해 연락처 목록을 조회READ_CONTACTS권한 선언 및 런타임 요청 구현2. 커스텀 ContentProvider 구현 - 출고 내역 조회
ShipmentContentProvider구현UriMatcher를 이용해 shipments 목록 및 단일 아이템 URI 구분 처리query,insert,delete,update기본 CRUD 기능 구현ShipmentDbHelper구현item_name,quantity,destination,timestampManifest에<provider>등록 완료3. ContentProvider Consumer UI -
ShipmentActivityShipmentContentProvider에 접근4. study-content-provider 구조 정리
exported="false")학습 목적 & 특징
이후 학습 방향 제안
FileProvider를 활용한 이미지 공유 실습exported,permission,grantUriPermission등 보안 전략