How to read contacts on Android 2.0

前端 未结 9 1131
我寻月下人不归
我寻月下人不归 2020-11-22 05:58

I\'m working on Android 2.0 and am trying to receive a list of all contacts.

Since android.provider.Contacts.People is deprecated, I have to use android

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 06:29

    Just want to add, when you are retrieving the contacts you might get a lot of "garbage" contacts - for example some email addresses that a user has at some point send an email to, but are not aggregated... If you want only the contacts visible to the user, as in the Androids own contacts application you need to restrict the selection to only IN_VISIBLE_GROUP.

        String where = ContactsContract.Contacts.IN_VISIBLE_GROUP + "= ? ";
        String[] selectionArgs = new String[] { "1" };
    

提交回复
热议问题