ContactFetcher
An app to read all contacts with emails and mobile numbers. It also supports multiple emails and mobile numbers.
Setup
To use this library your minSdkVersion must be >= 16.
In the build.gradle of your app module add:
dependencies {
implementation 'com.rocky.contactfetcher:contactfetcher:x.x.x'
}
Example
ContactFetcher.getContacts(this, new ContactListener<Contact>() {
@Override
public void onNext(Contact contact) {
// add contacts to list
}
@Override
public void onError(Throwable error) {
// log the error
}
@Override
public void onComplete() {
// process complete
}
});
in onRequestPermissionsResult() method
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
ContactFetcher.resolvePermissionResult(this, requestCode, permissions, grantResults);
}
This library is highly inspired by RXContacts : https://github.com/UlrichRaab/rx-contacts