This class provides rx api to work with phone contacts.
Instead of work with specific contact tables use the following abstractions:
UserContact
to work withContactsContract.Contacts
ContactPhone
to work withContactsContract.CommonDataKinds.Phone
ContactEmail
to work withContactsContract.CommonDataKinds.Email
To understand how this abstractions depends look to this simplified scheme
Contacts table (represents by UserContacts abstraction)
---------------------------------------------------------
|_ID | LOOKUP_KEY | DISPLAY_NAME | STARRED | ... etc |
---------------------------------------------------------
| 1 | abcdef | John Doe | 1 | ... |
---------------------------------------------------------
Data table (represents by ContactPhone or ContactEmail abstraction)
---------------------------------------------------------------
|_ID | CONTACT_ID | MIMETYPE | DATA1 | ... etc |
---------------------------------------------------------------
| 32 | 1 | PHONE NUMBER | 555-000-1111 | ... |
---------------------------------------------------------------
| 33 | 1 | EMAIL | [email protected] | ... |
---------------------------------------------------------------
Provide methods to query contacts by params declared in QueryProperty
,
or by specified uri.
Example usage:
RxContactsProvider.with(context)
.query(UserContact::class.java)
.where(QueryProperties.USER_NAME)
.isLike("User")
.fetchAll()
Or:
RxContactsProvider.with(context)
.fromUri(UserContact::class.java, contactUri)
For full list of functions, please look to the source code,example project or view documentation