Popularity
0.9
Growing
Activity
0.1
Declining
15
1
2

Description

Extract all the contacts from android 'Contacts' application by using simple easy-to-use apis. It helps to remove the overhead of querying contact content provider.

Programming language: Java
License: Apache License 2.0
Tags: Android     UI Widget     Java     Views     Content Provider     Android-library     Contacts    
Add another 'Contacts' Package

README

Android-Contact-Extractor-Library

platform Download API License

Extract all the contacts from android 'Contacts' application by using simple easy-to-use apis. It helps to remove the overhead of querying contact content provider.

Prerequisites

Add permission in AndriodManifest.xml:

<uses-permission android:name="android.permission.READ_CONTACTS"/>

Dependency

Add this to your module's build.gradle

Gradle

dependencies {
    ...
    implementation 'com.coderconsole.cextracter:contact-extractor:1.0.0'
}

Maven

<dependency>
  <groupId>com.coderconsole.cextracter</groupId>
  <artifactId>contact-extractor</artifactId>
  <version>1.0.0</version>
  <type>pom</type>
</dependency>

Ivy

<dependency org='com.coderconsole.cextracter' name='contact-extractor' rev='1.0.0'>
  <artifact name='contact-extractor' ext='pom' ></artifact>
</dependency>

Output

Extract all the contacts from android 'Contacts' application by using simple easy-to-use apis. It helps to remove the overhead of querying contact content provider.

Name Phone
name phone

Examples:

Extract all the PHONE - Its contains home/work/phone/other contacts within as HashSet<String>
    CQuery cQuery = CQuery.getInstance(getActivity());
    cQuery.filter(ICFilter.ONLY_PHONE);
    cQuery.build(new IContact() {
        @Override
        public void onContactSuccess(List<CList> cList) {
            if (cList != null && cList.size() > 0) {
                CPhone cPhone = cList.getcPhone();
                HashSet<String> home = cPhone.getHome();
                HashSet<String> work = cPhone.getWork();
                HashSet<String> mobile = cPhone.getMobile();
                HashSet<String> other = cPhone.getOther();
            }

        }

        @Override
        public void onContactError(Throwable throwable) {

        }
    });
Extract all the Email - It contains home/work/phone/other contacts as simple HashSet<String>
    CQuery cQuery = CQuery.getInstance(getActivity());
    cQuery.filter(ICFilter.ONLY_EMAIL);
    cQuery.build(new IContact() {
        @Override
        public void onContactSuccess(List<CList> cList) {
            if (cList != null && cList.size() > 0) {
                  CEmail cEmail = cList.getcEmail();
                  HashSet<String> home = cEmail.getHome();
                  HashSet<String> work = cEmail.getWork();
                  HashSet<String> mobile = cEmail.getMobile();
                  HashSet<String> other = cEmail.getOther();
            }

        }

        @Override
        public void onContactError(Throwable throwable) {

        }
    });
Extract all the Account - It name and its type e.g name - [email protected]/ type - com.google.com
    CQuery cQuery = CQuery.getInstance(getActivity());
    cQuery.filter(ICFilter.ONLY_ACCOUNT);
    cQuery.build(new IContact() {
        @Override
        public void onContactSuccess(List<CList> cList) {
            if (cList != null && cList.size() > 0) {
                   CAccount cAccount = cList.getcAccount();
            }

        }

        @Override
        public void onContactError(Throwable throwable) {

        }
    });

Bingo Thats it !!!. Just change filter types and get the contact information accordingly.

Acknowledgement

RxAndroid

Thank You

Please do follows us on TWITTER and check out BLOG.

codingIsAnArt

Licence

    Copyright (C) 2020 Nitesh Tiwari.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.


*Note that all licence references and agreements mentioned in the Android-Contact-Extractor README section above are relevant to that project's source code only.