반응형
📣 연락처 제공자 (Contact Provider)
- The Contacts Provider is a powerful and flexible Android component that manages the device's central repository of data about people. The Contacts Provider is the source of data you see in the device's contacts application, and you can also access its data in your own application and transfer data between the device and online services. The provider accommodates a wide range of data sources and tries to manage as much data as possible for each person, with the result that its organization is complex.
📷 Contact Provider Image 001 | 📷 Contact Provider Image 002 |
---|---|
📄 연락처 제공자 (Contact Provider) Manifest Source Code
<uses-permission android:name="android.permission.READ_CONTACTS"/> // Read Permission
<uses-permission android:name="android.permission.WRITE_CONTACTS"/> // Write Permission
📄 연락처 제공자 (Contact Provider) Source Code
final Cursor cursor = getContentResolver().query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI, // 조회할 컬럼명
null,
null,
null,
null
);
cursor.moveToFirst();
do {
final Pair<Integer, Integer> index = Pair.create(
cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME),
cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)
);
System.out.println( String.format("※ TEL -> Name: %s, Phone: %s", cursor.getString(index.first), cursor.getString(index.second)) );
} while ( cursor.moveToNext() );
📣 REFERENCE
반응형
'#모바일 [Mobile] > Android' 카테고리의 다른 글
[Android] Android Studio Assets Folder 만들기 (0) | 2019.06.27 |
---|---|
[Android] 브로드캐스트 리시버 (Broadcast Receiver) (0) | 2019.06.26 |
[Android] Service (0) | 2019.06.25 |
[Android] Android NDK (Native Development Kit) (0) | 2019.06.24 |
[Android] Android API (Application Programming Interface) Level (0) | 2019.06.24 |
댓글