Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I dont want emails . I want to extract phone numbers only #3

Open
mudassirzulfiqar opened this issue Mar 29, 2017 · 3 comments
Open

Comments

@mudassirzulfiqar
Copy link

Hey The library is awesome and build very well. I want to implement phone numbers not email . There should be an optional argument for both contact phone number and contact email.

@mjeftic
Copy link

mjeftic commented Apr 4, 2017

Also it would be nice if I could get only contact with email addresses. Nice library btw :-)

@vovander
Copy link

vovander commented Sep 4, 2017

You should add:
contactPicker.putExtra(ContactPickerActivity.CP_EXTRA_SELECTION, CP_SELECTION); contactPicker.putExtra(ContactPickerActivity.CP_EXTRA_SELECTION_ARGS, CP_SELECTION_ARGS);

and
public static final String CP_SELECTION = "(" + ContactsContract.Data.MIMETYPE + "=?)"; public static final String [] CP_SELECTION_ARGS = new String[] { ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE };

@adarshvijayanp
Copy link

Here is the solution. For emails only please refer the closed issue #1

    public void launchContactPicker(View view) {
    Intent contactPicker = new Intent(this, ContactPickerActivity.class);

    //phone numbers only
    String customSelection = "(" + ContactsContract.Data.MIMETYPE + "=? )";
    String [] customArgs = new String [] {ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE};
    contactPicker.putExtra(ContactPickerActivity.CP_EXTRA_SELECTION,customSelection);
    contactPicker.putExtra(ContactPickerActivity.CP_EXTRA_SELECTION_ARGS, customArgs);
    contactPicker.putExtra(ContactPickerActivity.CP_EXTRA_HAS_CUSTOM_SELECTION_ARGS, true); 
                                                                                                            
    startActivityForResult(contactPicker, CONTACT_PICKER_REQUEST);}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants