简体   繁体   中英

How to retrieve “standard” Android contacts

When I query ContactsContract.Contact programatically, the result contains more contacts than are displayed in the standard Google/Android contact application (named People). The contacts that are not shown in the Google app typically have no name or an email address as the name. Is there a standard query I can use to get the same list as Google's app?

My current code is:

    ContentResolver cr = getContentResolver();
    Cursor c = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
    if(c.getCount() > 0) {
        while(c.moveToNext()) {
            name = c.getString(c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
            names.add(name);
     }

The People app may be filtering out contacts based on user-controlled settings. For example, you can tell the People app to hide contacts that aren't in a group. In addition, the designers of People app may have decided to hide contacts without a useful name.

What is your use case for mimicking the People app exactly?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM