Last active
December 25, 2021 23:38
-
-
Save vestrel00/9904e4685fad59dec510fa503a83b104 to your computer and use it in GitHub Desktop.
An advance contacts query using https://github.com/vestrel00/contacts-android
This file contains 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
val contacts = Contacts(context) | |
.query() | |
.where { | |
(Name.GivenName startsWith "leo") and | |
(Email.Address { endsWith("gmail.com") or endsWith("hotmail.com") }) and | |
(Address.Country equalToIgnoreCase "us") and | |
(Event { (Date lessThan Date().toWhereString()) and (Type equalTo EventEntity.Type.BIRTHDAY) }) and | |
(Contact.Options.Starred equalTo true) and | |
(Nickname.Name equalTo "DarEdEvil") and | |
(Organization.Company `in` listOf("facebook", "FB")) and | |
(Note.Note.isNotNullOrEmpty()) | |
} | |
.accounts( | |
Account("john.doe@gmail.com", "com.google"), | |
Account("john.doe@myspace.com", "com.myspace"), | |
) | |
.include { setOf( | |
Contact.Id, | |
Contact.DisplayNamePrimary, | |
Phone.Number | |
) } | |
.orderBy(ContactsFields.DisplayNamePrimary.desc()) | |
.offset(0) | |
.limit(5) | |
.find() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment