Skip to content

Latest commit

 

History

History
92 lines (60 loc) · 1.62 KB

File metadata and controls

92 lines (60 loc) · 1.62 KB

Kontact

A mapper around Android's Contact APIs

Import the Dependency Download

To import the Android SDK, include it as a dependency in your build.gradle file

compile 'com.hackedcube:kontact:X.X.X'

Usage


To get all Contacts on the user's device

Java
List<Kontact> kontacts = ContactUtils.queryAllContacts(this);
Kotlin
val context = ...
        
val kontactList: List<Kontact> = context.queryAllContacts()

To get a specific Contact from an id

Java
Kontact kontact = ContactUtils.getContactFromId(this, <id>);
Kotlin
val context = ...
            
val kontact: Kontact = context.getContactFromId(<id>)




RX Support

Grab the correct dependency for which version of RxJava you are using


For RxJava 1

compile 'com.hackedcube:kontact-rxjava:X.X.X'

For RxJava 2

compile 'com.hackedcube:kontact-rxjava2:X.X.X'

To get all Contacts on the user's device as a Single

Java
Single<List<Kontact>> kontactsSingle = RxContactUtils.allContacts(this);
Kotlin
val context = ...
        
val kontactListSingle: Single<List<Kontact>> = context.allContacts()

To get a specific Contact from an id

Java
Single<Kontact> kontact = RxContactUtils.contact(this, <id>);
Kotlin
val context = ...
            
val kontact: Single<Kontact> = context.contact(<id>)